Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Google Cloud Platform logo

Google Cloud Pub/Sub Node.js Samples

Cloud Pub/Sub is a fully-managed real-time messaging service that allows you to send and receive messages between independent applications.

Table of Contents

Setup

  1. Read Prerequisites and How to run a sample first.

  2. Install dependencies:

     npm install
    

Samples

Topics

View the documentation or the source code.

Usage: node topics --help

Usage: node topics COMMAND [ARGS...]

Commands:

  create TOPIC_NAME
  delete TOPIC_NAME
  publish TOPIC_NAME MESSAGE
  list

Examples:

  node topics create my-topic
  node topics list
  node topics publish my-topic '{"data":"Hello world!"}'
  node topics delete my-topic

Subscriptions

View the documentation or the source code.

Usage: node subscriptions --help

Usage: node subscriptions COMMAND [ARGS...]

Commands:

  create TOPIC_NAME SUBSCRIPTION_NAME
  delete SUBSCRIPTION_NAME
  pull SUBSCRIPTION_NAME
  list [TOPIC_NAME]

Examples:

  node subscriptions create my-topic my-subscription
  node subscriptions delete my-subscription
  node subscriptions pull my-subscription
  node subscriptions list
  node subscriptions list my-topic

IAM

View the documentation or the source code.

Usage: node iam --help

Usage: node iam RESOURCE COMMAND [ARGS...]

Resources:

  topics
  subscriptions

Commands:

  get NAME
  set NAME
  test NAME

Examples:

  node iam topics get my-topic
  node iam topics set my-topic
  node iam topics test my-topic
  node iam subscriptions get my-subscription
  node iam subscriptions set my-subscription
  node iam subscriptions test my-subscription