• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt - MDB

 
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers

I have a doubt on MDBs...If an application exception is caught on the onMessage method of a MDB and I found that it is not possible to continue there after....So in the catch block I call ctx.setRollbackOnly() and re-throw the exception. Now what will happen?...Will the container try to deliver the message again to some other instance from the same pool or will the container simply discard the instance and discard the message?.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You make call ctx.setRollbackOnly() ,I assume that you use CMT MDB.

You can throws only System Exception ,in spec system exception will discard bean instance.
Then the container try to deliver msg other instance from the same pool(beacuase of method not complete).
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not asking about system exceptions...If I call ctx.setRollbackOnly() in the onMessage() method of a MDB then what will happen?.
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, if you use ctx.setRollbackOnly() I guess you are using CMT. With CMT the Message will be redelievered again and again and again...
That happens because the whole transaction (including the receipt of the message from the Queue) ist rolled back what means that the message is put back on the Queue.

Frank

[ October 10, 2005: Message edited by: Frank Ertl ]
[ October 10, 2005: Message edited by: Frank Ertl ]
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it. Thanks. But what will happen if my bean throws a system exception in both the cases, BMT and CMT.
 
Frank Ertl
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use CMT the bean instance will be discarded and the transaction will be rolled back unless you specify the transaction attribute to "NotSupported".
With bean managed persistence the bean instance will be discarded, too, but what happens to the message depends on your acknowlegement policy ("auto-acknowledge" vs. "dups-ok-acknowledge").
 
reply
    Bookmark Topic Watch Topic
  • New Topic