Skip to content

Latest commit

 

History

History
83 lines (61 loc) · 2.43 KB

README.md

File metadata and controls

83 lines (61 loc) · 2.43 KB

pubsubcat CI Go Report Card

The Google Pub/Sub Swiss Army Knife


pubsubcat is a developer's utility for using Google Cloud Pub/Sub. Use it to quickly peek into a topic or when you want to manually publish a message.

One of the main features is that this tool automatically creates a new temporary subscription on topic when you subscribe and cleans it when it's no longer used.

Inspired by kafkacat and initially created to get acquainted with Pub/Sub.

Installation

go get -u github.com/koenbollen/pubsubcat

Usage

Usage:
  pubsubcat [flags]
  pubsubcat [command]

Available Commands:
  create      Create topics and subscriptions
  help        Help about any command
  ls          List topics and subscriptions
  pipe        Pipe a topic directly to another using a temporary subscription
  pop         alias for: `pubsubcat subscribe --count 1 TOPIC`
  publish     Publish input lines as messages
  subscribe   Subscribe to a topic using a temporary subscription

Flags:
      --config string    config file (default is ~/.pubsubcat)
  -h, --help             help for pubsubcat
  -p, --project string   Google Cloud Project to work under
  -q, --quiet            only output messages
  -v, --verbose count    increase verbosity

Use "pubsubcat [command] --help" for more information about a command.

Examples

Create and list topics:

$ pubsubcat create my-topic
projects/bnl-blendle/topics/my-topic
$ pubsubcat ls
projects/bnl-blendle/topics/my-topic

pubsubcat can create and list topics and subscriptions with the default configuration.

Publish a message:

$ date | pubsubcat publish my-topic
] publishing lines from stdin to topic my-topic
] eof, syncing
$

pubsubcat read from stdin and publish each line as a message on the given topic.

Subscribing to a topic:

$ pubsubcat subscribe my-topic
] listening on topic "my-topic" using subscription "pubsubcat-my-topic-4d65822107fcfd52-1530794401"
Thu Jul  5 14:40:06 CEST 2018
^C
] stopped receiving, cleaning up temporary subscription

pubsubcat creates a temporary subscription to read from the given topic without consuming messages.