LLF
LLF

Reputation: 707

How to limit rabbitmq's queue to wait for ack before send message to other channels

I have an application that runs as multiple instances (pods on Kubernetes).

This application consumes messages from the queue with prefetch 1 and ack back after It finishes the process.

I have a function that must run from only one instance at a time. But the queue tries to send the next message to others instance consumers.

Is there anyways to block other consumers to not receive a message or block a queue to not send a message before ack?

Thanks you very much

Upvotes: 0

Views: 1697

Answers (1)

LLF
LLF

Reputation: 707

I've found the solution on the Rabbit MQ document now. I just need to put an argument "x-single-active-consumer" when declaring the queue.

https://www.rabbitmq.com/consumers.html#single-active-consumer

Upvotes: 1

Related Questions