Get information about missing consumer acknowledgements in publisher #12017
-
Hi, we want to use transactional outbox and inbox message pattern for sending and receiving messages from RabbitMQ. We plan to use a cluster in one datacenter and if the datacenter fails, the application will switch to the second datacenter. Inside the second datacenter a fresh standby RabbitMQ cluster gets started but without any kind of message forwarding etc. The idea is to replay the messages in the (replicated) outbox tables. In case of duplicates, that could be detected by (replicated) inbox tables. Our question is, how long we should keep publisher confirmed messages in the outbox tables to be sure, that they have been consumed by all potential consumers. Getting only the ACK for publishing won't be sufficient to decide as that messages will be lost if the datacenter is switched. Is there any way (RabbitMQ API call?) to detect, if all target consumers have succesfully consumed the message? Without introducing explicit response messages and need to track who should actually get the messages etc. ... That old thread does not seem promising unfortunately: Thanks in advance, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Publishers are completely separated from consumers in every messaging (and to a lesser extent, streaming) protocol RabbitMQ supports, by design. Our team cannot know for how long you should to keep messages "unconfirmed". I'd say twice as long as your 95% percentile message processing time on the consumer. If you don't have those metrics, a good place to start would be to start collecting them. A few minutes should be fine for most systems but it's just a guess. |
Beta Was this translation helpful? Give feedback.
-
Explicit response messages is the only way for publishers to know that the consumer has consumed and processed a message. You don't have to acknowledge each message individually. The same approaches for publisher confirms can work here, namely batching of confirmations, and redelivery of batches when you must redeliver. The moment when you start coupling publishers and consumers in any "synchronous way", your availability goes out the window because a single stuck consumer will block some or all publishers. If multiple data centers are involved, that could be followed by a false positive promotion. |
Beta Was this translation helpful? Give feedback.
Explicit response messages is the only way for publishers to know that the consumer has consumed and processed a message.
You don't have to acknowledge each message individually. The same approaches for publisher confirms can work here, namely batching of confirmations, and redelivery of batches when you must redeliver.
The moment when you start coupling publishers and consumers in any "synchronous way", your availability goes out the window because a single stuck consumer will block some or all publishers. If multiple data centers are involved, that could be followed by a false positive promotion.