This repository is for my article on Medium about Messaging with PubSub and Golang.
Replace the service_account.json with your key.
https://medium.easyread.co/event-driven-with-pubsub-and-golang-3924a4bba8a9
{
"type": "service_account",
"project_id": "",
"private_key_id": "",
"private_key": "",
"client_email": "",
"client_id": "",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": ""
}
Set environment variable for the service_account.json
path.
export GOOGLE_APPLICATION_CREDENTIALS="/workspace/go-pubsub-ws/.service_account.json"
printenv | grep GOO
Run the publisher server
go run ./cmd/publisher/main.go
Run the subscriber server
go run ./cmd/subscriber/main.go
Run the publisher server with docker-compose
docker-compose up publisher
Run the subscriber server with docker-compose
docker-compose up subscriber
Publish a message by access the endpoint