RamPrakash
RamPrakash

Reputation: 3312

GCP pub/sub - how to route messages

I have a pub/sub topic through which another application publishes some messages. Let's say messages like CustomerCreatedEvent.

external-app --> pub/sub

There is a country code in the message. based on that I would like to split that into 2 different topics. For ex: US customer into 1 topic and UK customer into another topic.

external-app --> pub/sub --> route based on country code 

Is there anyway to do using GCP services?

Upvotes: 0

Views: 198

Answers (1)

JL-V589
JL-V589

Reputation: 1044

As guillaume blaquiere mentioned, you might consider using the Filter messages from a subscription, where you only receive the messages that match the filter when you receive messages from a subscription with a filter. (Note: You can filter messages by their attributes, but not by the data in the message. And you can have multiple subscriptions attached to a topic and each subscription can have a different filter.)

Upvotes: 0

Related Questions