Subber is a golang CLI tool that allows you to interact with a PubSub local emulator.
A Google PubSub emulator is ready-to-use in the docker-compose file in the repo. If you have docker installed on your local machine, just clone the repo and start the container.
docker-compose up -d
The easiest way to get the tool is to download directly with go get
.
go get github.com/arthureichelberger/subber
You can also get the whole repository and install the tool.
git clone git@github.com:arthureichelberger/subber.git
cd subber
go install
For the reference, every command comes with a help flag (--help or -h
) that describes every flag and every possible usage.
subber createTopic
It will create a topic, if no other exists with the same ID, inside the emulator.
subber createSub
It will create a subscription, if no other exists with the same ID, inside the emulator.
subber listTopics
It will list all topics within the emulator.
subber listSubs
It will list all subscriptions within the emulator.
subber readSub
It will read messages from a subscription. By default, process will exit after 10 messages read. This can be configured through the --maxMessages=10
flag.
You can also choose to read the subscription interactively with the --interactively
flag and you'll have the choice to ack or nack every message.
subber publish
It will allow you to publish a message in a topic.
You can also pass a payload argument in case you'd like to cat a JSON file directly like this:
subber publish --payload="$(cat file.json)"