A project for learning and teaching pubsub using Go in the Google Cloud Platform using Google's Pubsub package

Purpose
TL;DR: If you are not a software developer, find another project.
There is no normal end user functionality provided. It's a project implemented using Go to build demonstration executables so the user can inspect the source code and run the executables to learn how to implement simple pubsub functionality in Google Cloud Platform using Google's Pubsub package.
Building
$ go build -o gcppubsub ./cmd/...
Pubsub Emulator
This project is meant to be used with the GCP Pubsub emulator. See these installation and execution instructions to get it installed and running.
In summary, install with
$ gcloud components install pubsub-emulator
$ gcloud components update
Execute with
$ gcloud beta emulators pubsub start --project=PUBSUB_PROJECT_ID
or
$ gcloud beta emulators pubsub start --host-port 127.0.0.1:9999
Executing
Quick Start for gcppubsub
In another terminal, execute the publisher with
$(gcloud beta emulators pubsub env-init)
$ gcppubsub publish
And in another terminal, execute the subscriber with
$(gcloud beta emulators pubsub env-init)
$ gcppubsub subscribe
Note the default for both the publish and subscribe commands are to publish and receive data continuously. Use Ctrl-C to stop execution noting that in this case, the subscription ID and topics will remain created in the emulator. When using the --once option these will be removed upon exit.
Help
There are command line options for gcppubsub. Use the --help flag to find them.
Examples
$ gcppubsub --help
$ gcppubsub subscribe --help
$ gcppubsub publish --help
Contributing
Contributions and bug fixes (and there are bugs because I also used this code to learn) are welcome. When contributing new functionality, try to keep the code straightforward because the purpose of this project is to help fellow developers learn. Try to use functions rather than methods.
Some areas for consideration:
- Defect remedies (bug fixes)
- Pubsub API usage improvements
- Unit Tests (as long as the code remains readable by novice Gophers)
- Additional command line options to expose more pubsub functionality