Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 590
  • Last Modified:

JMS vs MDB

i would like to know differences between JMS and MDB(message driven bean). Advantages, disadvantages, uses, comparisons of each other. when, where, how, why we use them. thanks in advance
0
gudii9
Asked:
gudii9
  • 2
2 Solutions
 
for_yanCommented:

JMS is Java API which allows to send and receive messages between the
java cprograms; see general description here
http://en.wikipedia.org/wiki/Java_Message_Service

as opposed to calling methods of the objects sending essages like in real life do not require
synchronous execution (this moment presence) - you'd normally sed the message and when that
your addresse picks up the message then it would send you an answer as opposed to calling the method
which normally implies immediate execution.
So JMS defines various object like the queue of messages, etc.
and like any other API defines methods of these objects which faciolitie this process of communication.
0
 
for_yanCommented:

A message-driven bean is an enterprise bean that allows J2EE applications to process messages asynchronously. It acts as a JMS message listener, which is similar to an event listener except that it receives messages instead of events. The messages may be sent by any J2EE component--an application client, another enterprise bean, or a Web component--or by a JMS application or system that does not use J2EE technology.

see here:

http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/EJBConcepts5.html

So message driven bean will process JMS Messages so it uses JMS API - in this way they are related
0
 
sreekanthbhargavCommented:
Hi ...

Here iam giving small overview, please go through the J2ee documentation for detailed explanation.

JMS  (Java Messaging Service) is messaging middleware API developed to exchange the messages between the enterprise applications.

1) point to point (Queues)
2) publishing/subscribing (Topic)

Message drive Bean is the Enterprise java bean is part of EJB specially designed to cater the JMS needs in the J2ee environment.


In JMS, there is publish and subscribing API for the both the Queues and Topic.
 There are two types of communications i.e. synchronous and asynchronous.

Synchronous: the subscriber utility has to be invoked to pick the message from the JMS Queue/Topic

Asynchronous:_ the subscriber utility continuously listening to the JMS Queue by implementing the MessageListner interface, once the message arrived to the queue, it will start picking the message imediately. No need to invoke the utility every time to pick the message.

For Enterprise applications, almost the number of messages received by the JMS queues are in huge numbers.
So normal JMS subscriber utility which is implemented Asynchronous jms api can not handle the requests effectively.

To over come this, MDB introduced which is also implemented the Message Listener interface deployed as EJB module in Application server having capability of processing (subscribing from the JMS Message Queue) multiple requests in distributed environment with scalability and security.


Thanks,
Sreekanth


0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now