Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

JMS and MDB

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

When to usa JMS as opposed to MDB?
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mary Cole
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thx for your reply

I got it
 
Have you no shame? Have you no decency? Have you no tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic