• Post Reply Bookmark Topic Watch Topic
  • New Topic

JMS Message Driven Bean

 
John R Roberts
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a message is passed into the onMessage method of a message driven bean at what point is it removed from the queue/topic?
Is it removed when the onMessage method completes or as soon as the method is invoked?

thanks,
 
John R Roberts
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone...
 
Sumit Malik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John R Roberts,

Well, we know MDB is always deployed against a particular queue/topic. So when you are sending message to queue and MDB fetch message from that queue then this is where the message gets detached from queue. See if within MDB you get any exception then even in that case we dont have any message left in queue.

I hope this would help you up...

Cheers !!!
Sumit Malik
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Logically, it makes more sense to let the message handler complete before removing the message. To find this out experimentally, you can write a long-running message handler and look into the message queue while this function is running
[ March 30, 2007: Message edited by: Edvins Reisons ]
 
Sumit Malik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Edvins Reisons,

Good thought !!! Well, I believe that once MDB get message from queue then it(message) gets detached from queue. We must play around with your suggestion

Cheers !!!
Sumit Malik
 
John R Roberts
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the help!!!
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have never worked on EJB's before , nor I know much about these.

Please correct me if I am wrong.

It all depends on the way you configure the MDB in the descriptor.Even it depends on the acknowledgement type that you set.You can configure it to send acknowledgement as soon as the method complets.In case of MDB's configured to durable topics , if the bean encounters exception then another bean is choosen to do the task again.You can even set up the number to times this process should take place before discarding the message totally.
[ March 30, 2007: Message edited by: Rahul Bhattacharjee ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!