Skip to content

Latest commit

 

History

History
119 lines (82 loc) · 3.29 KB

README.md

File metadata and controls

119 lines (82 loc) · 3.29 KB

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

Commands:
  create <name>              Create a new topic.
  list                       List topics.
  publish <topic> <message>  Publish a message to the specified topic.
  delete <name>              Delete the specified topic.

Options:
  --help  Show help                                                    [boolean]

Examples:
  node topics create my-topic               Create a new topic named "my-topic".
  node topics list                          List topics.
  node topics publish my-topic              Publish a message to "my-topic".
  '{"data":"Hello world!"}'
  node topics delete my-topic               Delete a topic named "my-topic".

For more information, see https://cloud.google.com/pubsub/docs

Subscriptions

View the documentation or the source code.

Usage: node subscriptions --help

Commands:
  create <topic> <name>  Create a new subscription.
  list [topic]           List subscriptions.
  pull <subscription>    Pull messages from the specified subscription.
  delete <subscription>  Delete the specified subscription.

Options:
  --help  Show help                                                                        [boolean]

Examples:
  node subscriptions create my-topic my-subscription  Create a new subscription.
  node subscriptions delete my-subscription           Delete a subscription.
  node subscriptions pull my-subscription             Pull messages from "my-subscription".
  node subscriptions list                             List all subscriptions.
  node subscriptions list my-topic                    List subscriptions to topic "my-topic".

For more information, see https://cloud.google.com/pubsub/docs

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