1

I need to process messages in batches, lets say of 10. After 10 transactions (or some timeout has passed), there will be a single commit for all 10 transactions and if any exceptions have occurred all ten messages will be rolled back and redelivered.

Our application runs on Weblogic 11g and I know that this functionality exists using weblogic MDBs (batching jms messages http://docs.oracle.com/cd/E13222_01/wls/docs90/bridge/tuning.html).

We rely heavily on spring in our application and would rather not use any EJBs for various reasons. Is there a way to achieve this using spring MDPs? Or is there a tool out there that will?

matt.early
  • 225
  • 2
  • 10

1 Answers1

0

This is not a huge thing to implement yourself. I in fact did it yesterday (although in c# it was still against JMS)

So while I cant offer you a direct answer I can tell you about the experience I had implementing the same requirement

The one gotcha I ran into was that I was running multiple consumers on a queue (each providing batching) and the prefetch on the queue meant that my JMS broker was round robining delivery of messages to my consumers

This is perfectly acceptible behaviour but kind of goes against the batching idea.I ended up rolling my own synchronization mechanism across the consumers to coordinate who was consuming and more importantly turning prefetch off.

Fen
  • 933
  • 5
  • 13
  • What I am thinking about doing is extending the DefaultMessageListenerContainer and overriding receiveAndExecute(), which is where spring handles the transaction. I would rather use a built in spring function, but it may not exist. Thanks for the reply – matt.early Mar 21 '12 at 15:24