Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JMS (MDB) and queuing undeliverable msgs  RSS feed

 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a situation where, if I cannot process a message in an MDB (onMessage event) I want to leave the item on the queue and have it processed later by a QueueBrowser type utility that cleans up. The problem I see is that if I throw and EJBException in the onMessage when my message is undeliverable, I get into a loop where the MDB is kicked off and endlessly re-trying the message. I could put the undeliverable message on another queue (deferred-type queue) and process it with a separate listener there (not an MDB) but I wondered if there were any other ways around this.

Thanks
Max Tomlinson
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I think I've answered my own question:
We're using BEA so I can set a RedeliveryDelay as well as RedeliveryLimit on the QueueConnectionFactory.

Max

[ January 10, 2006: Message edited by: Max Tomlinson ]
[ January 10, 2006: Message edited by: Max Tomlinson ]
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Side note for others: Its generally not a good idea to throw an Exception from a MDB because the message will keep being reprocessed - this is called a 'poision message'
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Second side note: you couldn't use a QueueBrowser to solve this problem because a QueueBrowser only gives you a copy of the message, you aren't causing any kind of acknowledgement of the original message in the queue. Also, QueueBrowsers can be a bit flakey in some J2EE servers.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!