This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes JMS and MDB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS and MDB" Watch "JMS and MDB" New topic
Author

JMS and MDB

Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Hi All,

When to usa JMS as opposed to MDB?
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Mary,

EJB components (other than MDB), can act as JMS producers creating and sending messages to JMS destinations. However they cannot act as an asynchronous JMS consumers. A SLSB can use JMS API and waiting for a message, but this synchronous operation could block the thread indefinitely. This was the reason why MDB were added to EJB2.0 in the first place anyway: to allow J2EE component to asynchronously process JMS message. Besides is much easier to develop a MDB consumer than using JMS API and write your own.
As for your question is very hard for me to imagine why to use JMS API when building a J2EE application; it might be a good solution for integrating with other queuing services, like IBM MQSeries, or having a simple JMS client application, but that�s another story. One reason not to use MDB might be the need to implement a JMS consumer that processes messages synchronously. But in that case why to use JMS in the first place anyway?
I hope this will help.
Regards.


I think, therefore I exist -- Rene Descartes
Mary Cole
Ranch Hand

Joined: Dec 02, 2000
Posts: 362
Thx for your reply

I got it
 
jQuery in Action, 2nd edition
 
subject: JMS and MDB
 
Similar Threads
MDB question
What is the relationship between JMS and MDB?
[MDB] K&B, What technique is better ?
Message Driven Bean and JMS
Asynchronous Messaging Solution other than MDB