This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Rationale for Message Driven Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Rationale for Message Driven Beans" Watch "Rationale for Message Driven Beans" New topic
Author

Rationale for Message Driven Beans

John Davis
Ranch Hand

Joined: Nov 02, 2000
Posts: 183
What is the rationale for message driven beans? (EJB functionality is available in core J2EE without using JMS).
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
If you want to be able to perform asynchronous processing, session beans and entity beans are of no use. This is where the rationale for MDBs expresses itself.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
John Davis
Ranch Hand

Joined: Nov 02, 2000
Posts: 183
Lasse,
But I don't see how that answer explains anything. If the functionality was available synchronously, what would be the rationale for a developer "wishing" to process it asynchronously ?
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Let's say you have a component that is responsible for doing something very CPU intensive or otherwise long-lasting. The component might be forced to call a web service provided by a 3rd party across the globe. Is it feasible to let your end users wait for 10 minutes before a blank browser window? I doubt it -- even if their browsers wouldn't timeout before the 10 minutes... In this kind of situations it's useful to have ways to do things asynchronously -- you're not forced to wait for the response.
John Davis
Ranch Hand

Joined: Nov 02, 2000
Posts: 183
Lasse,
Thank you for that answer. Now I understand, and for the record, you can never be sufficiently paranoid.
JD
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

Here is a tutorial
http://www.theserverside.com/resources/article.jsp?l=Pramati-MDB


Groovy
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
...and for the record, you can never be sufficiently paranoid.

Or can I?
John Davis
Ranch Hand

Joined: Nov 02, 2000
Posts: 183
Lasse,
Probably not.
but to return to the original topic, can you think of way (using a servlet as an EJB client) to obtain a long-running EJB's functionality without JMS/MDB and without requiring an end-user to wait? I hope there is a way because I would like to avoid the additional infrastructure expense involved in providing a transport layer for JMS.
Regards,
JD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rationale for Message Driven Beans
 
Similar Threads
Passed SCEA Part I 91%
can MDB used for Topic listening?
From HFEJB book- pg.108
Message Driven POJO
Message driven Bean