Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Could any one tell me what's the benefit of Message Driven EJBs?  RSS feed

 
Robert Strong
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could any one tell me what's the benefit of Message Driven EJBs? and give me some examples of applications of Message Driven EJBs
thanx
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to suppose MDB are based on JMS. They provided a time wise decoupling of applications.
Whereas when one calls a EJB method you are blocked until the EJB returns.
An MDB can be fire and forget.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's say that you are fulfillment service waiting for shipping orders. Your client drops a message into the queue and your MDB kicks off a process to ship the items to the client.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One big advantage to MDBs over standard JMS Listeners is that the EJB Container take care of pooling. Need more listeners? Increase the number of mdbs in the pool without touching code!!!
No more need for startup classes just to register JMS listeners in your Application Server!!!
MDBs also take care of keeping connections active.
The queue or topic that an MDB listens to is set declaratively in the deployment descriptor. No more breaking open the code just to change a queue name!!!
Did I mention that I like MDBs?
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like sending a message to a process that's down or unavailable. Everything still works fine.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another benefit is that in the upcoming EJB 2.1 Specification mdbs will be able to listen to other message types in addition to JMS Messages. That is going to be sweet!
 
Graham Thorpe
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any body tell examples about jms on weblogic7.0.................
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The major difference between JMS Listeners (available in base JMS) and MDB's is that MDB's start a transaction on message receipt AND the message receipt is included in the transaction. Thus if as part of the processing of the message the transaction is rolled back (perhaps due to a database error) the message is placed back on the queue and is not considered to be "consumed".
Kyle
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!