This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum 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
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply 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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: JMS and MDB
 
Similar Threads
Message Driven Bean and JMS
[MDB] K&B, What technique is better ?
MDB question
What is the relationship between JMS and MDB?
Asynchronous Messaging Solution other than MDB