/poc-gcloud-pubsub

Basic PoC/test code for using Google Cloud Platform PubSub from Go

Primary LanguageGo

poc-gcloud-pubsub

Basic PoC/test code for using Google Cloud Platform PubSub from Go.

Setup

You will need to create a topic and a subscription on that topic for the subscriber to use.

# Setup environment variables
source ./auth.sh

# Get go dependencies
dep ensure

# Create a topic
gcloud beta pubsub topics create my-test-topic --project testpubsubstuff

# Create a subscription
gcloud beta pubsub subscriptions create foo-subscription --topic my-test-topic --project testpubsubstuff

# List topics
gcloud beta pubsub topics list --project testpubsubstuff

# List subscriptions
gcloud beta pubsub subscriptions list --project testpubsubstuff

Usage

# Setup environment variables
source ./auth.sh

# Run
go run subscriber.go
go run publisher.go

Cleanup

# Setup environment variables
source ./auth.sh

# Remove subscription
gcloud beta pubsub subscriptions delete foo-subscription --project testpubsubstuff

# Remove topic
gcloud beta pubsub topics delete my-test-topic --project testpubsubstuff

Misc