2021年3月28日星期日

message order is changed inside rabbitMQ queue

I write a simple chat application based on rabbitMQ. I check messages based on the property set on the header. When someone consumes a message first deserialize the header to find out this message target is correct or not. If message target is correct use ack() instead use nack(). In some situations, the message order that comes to the queue is changed. Is there any way to prevent the message order changed?

for example I have 5 message in queue:  one -> for user 1  two -> for user 2  three -> for user 1  four -> for user 2  five -> for user 1  

two sides of clients consume at the same time and two clients consume all messages and use ack() or nack(). after consuming messages order is changed. for example, message 4 coming before the message 2 and other order is changed. because message order in the chat application is important I should fix this issue. Thanks

https://stackoverflow.com/questions/66838959/message-order-is-changed-inside-rabbitmq-queue March 28, 2021 at 02:33PM

没有评论:

发表评论