Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/owenrumney/pubsub
Simple pubsub tool to work with GCP PubSub emulator
https://github.com/owenrumney/pubsub
gcp pubsub
Last synced: 9 days ago
JSON representation
Simple pubsub tool to work with GCP PubSub emulator
- Host: GitHub
- URL: https://github.com/owenrumney/pubsub
- Owner: owenrumney
- Created: 2023-01-23T15:14:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-25T02:35:33.000Z (over 1 year ago)
- Last Synced: 2024-10-06T22:22:45.944Z (30 days ago)
- Topics: gcp, pubsub
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pubsub
## What is it?
It's a simple pubsub implementation in Go for interacting with the [GCP PubSub Emulator](https://cloud.google.com/sdk/gcloud/reference/beta/emulators/pubsub).
The standard `gcloud pubsub` command [doesn't support using the emulator](https://cloud.google.com/pubsub/docs/emulator?authuser=2#using_the_emulator).
## How do I use it?
### Install
The simplest and only way to install at the moment is to use `go install`... other ways will be added shortly.
```bash
go install github.com/owenrumney/pubsub/cmd/pubsub@latest
```### Operation?
To get the top level help, use
```bash
pubsub --helppubsub help
Usage:
pubsub [command]Available Commands:
help Help about any command
subscriptions List create and delete subscriptions
topics List create and delete topicsFlags:
-d, --debug Enable debug logging
-h, --help help for pubsub
-p, --project string GCP project ID (default "test-project")
-t, --topic-name string Topic nameUse "pubsub [command] --help" for more information about a command.
```All commands require a project ID to be set using `-p` or `--project`. If this isn't done, the default `test-project` is used. Optionally, you can set the `PROJECT_ID` environment variable to save you the keystrokes.
#### Topics
To get help on topics, use
```bash
pubsub topics --helpList create and delete topics
Usage:
pubsub topics [command]Available Commands:
create Create a topic
delete Delete a topic
list List topics
tail Tail a topicFlags:
-h, --help help for topicsGlobal Flags:
-d, --debug Enable debug logging
-p, --project string GCP project ID (default "test-project")
-t, --topic-name string Topic nameUse "pubsub topics [command] --help" for more information about a command.
```
##### Listing Topics
```bash
pubsub topics -p my-test-project list
```##### Creating Topics
```bash
pubsub topics create -p my-test-project -t my-topic
```##### Deleting Topics
```bash
pubsub topics delete -p my-test-project -t my-topic
```##### Tailing Topics
Default tail is for 10 minutes, this can be changed with the `--tail-duration` flag; use the format `10s` for 10 seconds, `5m` for 5 minutes, `1h` for 1 hour, etc.
```bash
pubsub topics tail -p my-test-project -t my-topic --tail-duration 5m
```#### Subscriptions
To get help on subscriptions, use
```bash
pubsub subscriptions --helpList create and delete subscriptions
Usage:
pubsub subscriptions [command]Available Commands:
create Create a subscription
delete Delete a subscription
list List subscriptionsFlags:
-h, --help help for subscriptionsGlobal Flags:
-d, --debug Enable debug logging
-p, --project string GCP project ID (default "test-project")
-t, --topic-name string Topic nameUse "pubsub subscriptions [command] --help" for more information about a command.
```##### Listing Subscriptions
```bash
pubsub subscriptions -p my-test-project list
```##### Creating Subscriptions
```bash
pubsub subscriptions create -p my-test-project -t my-topic -s my-subscription
```When creating a subscription, you can optionally create push endpoint using the `-e` or `--push-endpoint` flag.
##### Deleting Subscriptions
```bash
pubsub subscriptions delete -p my-test-project -s my-subscription
```