Replacing a message in a jms queue?

This sounds like an ideal use case for the Idempotent Consumer which removes duplicates from a queue or topic.

This sounds like an ideal use case for the Idempotent Consumer which removes duplicates from a queue or topic. The following example shows how to do this with Apache Camel which is the easiest way to implement any of the Enterprise Integration Patterns, particularly if you are using ActiveMQ which comes with Camel integrated out of the box from("activemq:queueA"). IdempotentConsumer(memoryMessageIdRepository(200)).

Header("myHeader"). To("activemq:queueB"); The only trick to this is making sure there's an easy way to calculate a unique ID expression on each message - such as pulling out an XPath from the document or using as in the above example some unique message header.

You could browse the queue and use selectors to identify the message. However, unless you have a small amount of messages this won't scale very well. Instead, you message should just be a pointer to a database-record (or set of records).

That way you can update the record and whoever gets the message will then access the latest version of the record.

Thanks Dave. I am actually trying to make sure that there aren't any duplicate messages on the queue to reduce the amount of processing that is happening whenever the consumer gets the message. Hence I would like either to replace a message or not even put it on the queue.

Udi – Udi Oct 24 '08 at 20:08.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions