Categorygithub.com/FernandoCagale/gcp-pub-sub
repository
0.0.0-20200714202452-c0f9f24ffdb9
Repository: https://github.com/fernandocagale/gcp-pub-sub.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

GCP Pub/Sub

Go Mod

  • Download dependencies
$ go mod download
  • Vendor local
$ go mod vendor

Configurable environment variables LOCAL

  • Rename file .envsample to .env
$ cp .envsample .env
NameRequiredDescription
KEYTRUEFile private key GCP
PROJECTTRUEName project GCP

Example

  • Create topic and subscription
$   go run topic/main.go -s sub-v1,sub-v2,sub-v3
$   2020/07/14 13:09:03 Topic created:  topic
$   2020/07/14 13:09:07 Subscription created:  sub-v1
$   2020/07/14 13:09:13 Subscription created:  sub-v2
$   2020/07/14 13:09:17 Subscription created:  sub-v3
  • Publish
$   go run publish/main.go -t topic -m golang
  • Receiver-v1
$   go run receiver/main.go -t topic -s sub-v1
$   2020/07/14 13:30:33 Subscription sub-v1 Got message: "golang"
  • Receiver-v2
$   go run receiver/main.go -t topic -s sub-v2
$   2020/07/14 13:30:33 Subscription sub-v2 Got message: "golang"
  • Receiver-v3
$   go run receiver/main.go -t topic -s sub-v3
$   2020/07/14 13:30:33 Subscription sub-v3 Got message: "golang"