Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

priotizing a message on Google Pubsub

I have a pubsub topic with a number of pull subscriptions. I would like some mechanism where I can publish a message with a "priority" label that causes the message to jump as near to the front of the queue as possible.

I don't need any guaranteed ordering semantics, just a "best effort" prioritization mechanism.

Is anything like this possible with pubsub?

like image 836
Alex Flint Avatar asked Sep 24 '18 20:09

Alex Flint


People also ask

Are Pubsub messages ordered?

Pub/Sub delivers each message at least once, so the Pub/Sub service might redeliver messages. When you receive messages in order and the Pub/Sub service redelivers a message with an ordering key, Pub/Sub maintains order by also redelivering the subsequent messages with the same ordering key.

Is Google Pubsub a message queue?

Google Cloud Pub/Sub is a scalable, durable event ingestion and message delivery system that allows you to create an infrastructure whose responsibility is to handle message queues. Pub/Sub delivers low-latency, durable messaging by using two core components: topics and subscriptions.

Can Pubsub hold millions of messages?

Resource limitsThere is no limit on the number of retained messages. If subscribers don't use a subscription, the subscription expires. The default expiration period is 31 days. The service might impose limits on the total number of outstanding StreamingPull messages per connection.


1 Answers

No such mechanism exists within Google Cloud Pub/Sub, no. Such a feature really only becomes relevant if your subscribers are not able to keep up with the rate of publishing and consequently, a backlog is building up. If subscribers are keeping up and processing and acking messages quickly, then the notion of "priority" messages isn't really necessary.

If a backlog is being built up and some messages needs to be processed with higher priority, then one approach is to create a "high-priority" topic and subscription. The subscribers subscribe to this subscription as well as the "normal" subscription and prioritize processing messages from the "high-priority" subscription whenever they arrive.

like image 136
Kamal Aboul-Hosn Avatar answered Sep 22 '22 21:09

Kamal Aboul-Hosn