What is the best way to reject messages with the same body in AMQ queue?
Posted
by archer
on Stack Overflow
See other posts from Stack Overflow
or by archer
Published on 2010-03-18T21:00:41Z
Indexed on
2010/03/18
22:31 UTC
Read the original article
Hit count: 216
I have a single AMQ queue that receives simple messages with string body. Consider I'm sending CLSIDs as message bodies. CLSIDs could be not unique, but I'd like to reject all messages with not unique bodies and keep only single instance of such messages in the queue. Is there any simple way to do it?
Currently I'm using a workaround. Messages from the queue are consumed by some processor that tries to insert bodies into a simple DB table with UNIQUE constraint applied to message_body field. If processor inserts the messages succesfuly - it's assigned to exchange.out.body and sent to other queue. If ConstraintViolationException is thrown - nothing is resent to other queue.
I would like to know does AMQ support something similar out of the box?
© Stack Overflow or respective owner