Akhil Kodali wrote:
The queue doesnot duplicate the message, the application happens to post
it as it is unable to determine what is in the queue.
Is it doing something like resending a request if it doesn't receive a
reply quickly enough? The only way you can deal with this is to somehow
make requests idempotent, by discarding duplicates on the receiving side.
To avoid duplicates one way is to expire out the messages in the queue
after certain period of time, anyway to configure it.
Currently I am checking it at the application level.
The application level is all there is at the moment. There is an
"expiration" field associated with each message that is intended to be
used to permit the server to GC old messages, but RabbitMQ does not
currently implement it, in part because it's tricky technically (I know,
I know, it shouldn't be, but there you have it), and in part because the
AMQP standard is in fact silent on both the syntax and the meaning of
the field (!!).
So it sounds like you're currently on the right approach: discarding
duplicates at the receiving end, based on either or both of an expiry
time and a unique message ID.