Grouping topics or subscriptions to listen to many topics without creating many subscriptions

1,313 views
Skip to first unread message

pi...@pathao.com

unread,
Jun 6, 2018, 6:47:59 AM6/6/18
to Google Cloud Pub/Sub Discussions
Hello :),
I am using Go client libraries and encountered a scenario where there are over 100 topics, but creating over 100 subscriptions is cumbersome.
Is there any feature supported by the client libraries to group subscriptiosn or topics?

Alex Mordkovich

unread,
Jun 6, 2018, 11:57:15 AM6/6/18
to pi...@pathao.com, Google Cloud Pub/Sub Discussions
Hi!

What exactly do you mean by "group subscriptions or topics"? Are you trying to create a subscription to each of the 100 topics? This can be done programmatically via the client library (e.g., in a for loop) or you could use the gcloud CLI (e.g., in a bash script): https://cloud.google.com/sdk/gcloud/. Note that a given subscription can only be "attached" to one topic. If you want your subscriber(s) to consume messages from multiple topics, you need to create a subscription to each topic, republish the messages to a "combined" topic, and then create a subscription to that "combined" topic.

--
You received this message because you are subscribed to the Google Groups "Google Cloud Pub/Sub Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloud-pubsub-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloud-pubsub-discuss/a737b65e-05eb-4646-8c0d-f58a13c4ed66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pinku Deb Nath

unread,
Jun 7, 2018, 7:19:45 AM6/7/18
to Alex Mordkovich, Google Cloud Pub/Sub Discussions
Hi,
Yes, I was trying to create a single subscription/group to 100 topics, to which multiple subscribers can connect.
I figured out the for loop solution, thank you for suggesting this approach. Cheers!
Reply all
Reply to author
Forward
0 new messages