Solved

JMS vs MDB

Posted on 2011-09-05
3
486 Views
Last Modified: 2012-08-13
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
Comment
Question by:gudii9
  • 2
3 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 36485307

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
 
LVL 47

Accepted Solution

by:
for_yan earned 250 total points
ID: 36485317

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
 
LVL 1

Assisted Solution

by:sreekanthbhargav
sreekanthbhargav earned 250 total points
ID: 36486926
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Android studio getdrawable(int) is deprecated 4 124
jdbc error in jsp application 20 64
eclipse with Angularjs2.0 3 57
How to convert from xls to xlsx using java 7 57
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to implement Singleton Design Pattern in Java.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question