@@ -19,6 +19,7 @@ This client supports the following Google Cloud Platform services at a [General
19
19
This client supports the following Google Cloud Platform services at a [ Beta] ( #versioning ) quality level:
20
20
21
21
* [ Cloud Natural Language] ( #cloud-natural-language-beta ) (Beta)
22
+ * [ Cloud Pub/Sub] ( #cloud-pubsub-alpha ) (Beta)
22
23
* [ Cloud Spanner] ( #cloud-spanner-beta ) (Beta)
23
24
* [ Cloud Vision] ( #cloud-vision-beta ) (Beta)
24
25
* [ Google BigQuery] ( #google-bigquery-beta ) (Beta)
@@ -28,7 +29,6 @@ This client supports the following Google Cloud Platform services at an [Alpha](
28
29
29
30
* [ Cloud Bigtable] ( #cloud-bigtable-alpha ) (Alpha)
30
31
* [ Cloud DNS] ( #cloud-dns-alpha ) (Alpha)
31
- * [ Cloud Pub/Sub] ( #cloud-pubsub-alpha ) (Alpha)
32
32
* [ Cloud Resource Manager] ( #cloud-resource-manager-alpha ) (Alpha)
33
33
* [ Cloud Speech] ( #cloud-speech-alpha ) (Alpha)
34
34
* [ Google Compute Engine] ( #google-compute-engine-alpha ) (Alpha)
@@ -450,6 +450,57 @@ languageClient.analyzeSentiment({document: document}).then(function(responses) {
450
450
```
451
451
452
452
453
+ ## Cloud Pub/Sub (Beta)
454
+
455
+ - [ API Documentation] [ gcloud-pubsub-docs ]
456
+ - [ Official Documentation] [ cloud-pubsub-docs ]
457
+
458
+ #### Using the Cloud Pub/Sub API module
459
+
460
+ ```
461
+ $ npm install --save @google-cloud/pubsub
462
+ ```
463
+
464
+ ``` js
465
+ var pubsub = require (' @google-cloud/pubsub' );
466
+ ```
467
+
468
+ #### Authentication
469
+
470
+ See [ Authentication] ( #authentication ) .
471
+
472
+ #### Preview
473
+
474
+ ``` js
475
+ var pubsubClient = pubsub ({
476
+ projectId: ' grape-spaceship-123' ,
477
+ keyFilename: ' /path/to/keyfile.json'
478
+ });
479
+
480
+ // Reference a topic that has been previously created.
481
+ var topic = pubsubClient .topic (' my-topic' );
482
+
483
+ // Publish a message to the topic.
484
+ var publisher = topic .publisher ();
485
+ var message = new Buffer (' New message!' );
486
+
487
+ publisher .publish (message, function (err , messageId ) {});
488
+
489
+ // Subscribe to the topic.
490
+ topic .createSubscription (' subscription-name' , function (err , subscription ) {
491
+ // Register listeners to start pulling for messages.
492
+ function onError (err ) {}
493
+ function onMessage (message ) {}
494
+ subscription .on (' error' , onError);
495
+ subscription .on (' message' , onMessage);
496
+
497
+ // Remove listeners to stop pulling for messages.
498
+ subscription .removeListener (' message' , onMessage);
499
+ subscription .removeListener (' error' , onError);
500
+ });
501
+ ```
502
+
503
+
453
504
## Cloud Spanner (Beta)
454
505
455
506
- [ API Documentation] [ gcloud-spanner-docs ]
@@ -816,54 +867,6 @@ zone.export('/zonefile.zone', function(err) {});
816
867
```
817
868
818
869
819
- ## Cloud Pub/Sub (Alpha)
820
-
821
- - [ API Documentation] [ gcloud-pubsub-docs ]
822
- - [ Official Documentation] [ cloud-pubsub-docs ]
823
-
824
- #### Using the Cloud Pub/Sub API module
825
-
826
- ```
827
- $ npm install --save @google-cloud/pubsub
828
- ```
829
-
830
- ``` js
831
- var pubsub = require (' @google-cloud/pubsub' );
832
- ```
833
-
834
- #### Authentication
835
-
836
- See [ Authentication] ( #authentication ) .
837
-
838
- #### Preview
839
-
840
- ``` js
841
- var pubsubClient = pubsub ({
842
- projectId: ' grape-spaceship-123' ,
843
- keyFilename: ' /path/to/keyfile.json'
844
- });
845
-
846
- // Reference a topic that has been previously created.
847
- var topic = pubsubClient .topic (' my-topic' );
848
-
849
- // Publish a message to the topic.
850
- topic .publish (' New message!' , function (err ) {});
851
-
852
- // Subscribe to the topic.
853
- topic .subscribe (' subscription-name' , function (err , subscription ) {
854
- // Register listeners to start pulling for messages.
855
- function onError (err ) {}
856
- function onMessage (message ) {}
857
- subscription .on (' error' , onError);
858
- subscription .on (' message' , onMessage);
859
-
860
- // Remove listeners to stop pulling for messages.
861
- subscription .removeListener (' message' , onMessage);
862
- subscription .removeListener (' error' , onError);
863
- });
864
- ```
865
-
866
-
867
870
## Cloud Resource Manager (Alpha)
868
871
869
872
- [ API Documentation] [ gcloud-resource-docs ]
0 commit comments