Can i organize sequential task queue with Nats?

Viewed 91

I have multiple queues in Nats with subjects like "queue.1", "queue.2" and etc, multiple workers in the same queue group (let's call it just group). This workers subscribed to "queue.*", Which means that they want to receive messages from all queues. But i need to process this messages in sequential manear in context of one queue. For now if the producer will send message "task.1" to "queue.1" and this message will process slowly by "worker.1", slower than producer will sent message "task.2" to the same queue - it means that another "worker.2" will get message "task.2" before "task.1" will be processed. How can i await "task.1" before processing "task.2"

0 Answers
Related