I want to do a "delay and collect operation" on a JMS queue and wonder if anyone has any ideas on what would be the best way to accomplish this... The idea is that A sender sends a lot of "the same" messages and I want to collect them and sort through all "doubles" and only act on "one". The messages are sent out of order? For instance The sender send in order: Msg A, id=1, Msg B id=2, Msg A id=3, Msg A id=1, ... Then I want to delay the messages for "a while" (a few minutes) and then "see" that "Msg A id=1" has been sent twice during this time period and only "act" on the latest instance. The beans are "read" from a EJB context as message beans in a JBoss environment (but other application server might be used). // MickeM
- Posted by: Michael Medin
- Posted on: October 05 2006 04:10 EDT
One way to implement your requirement is by pooling the messages in a local pool and then a seperate thread that checks this pool every x minutes to remove duplicate messages and start processing messages.
Yes, but is that a practical solution inside the application server? I can see this as an option for a stand-alone server that does message processing but not using MDB? // MickeM
Message delivery to asynch recievers cannot be manupulated, MDBS will recieve the messages through a message broker which sits on the JMS server, so delay in that is not configurable. cheers, http://www.javaicillusion.blogspot.com/