JavaUser
JavaUser

Reputation: 26344

Difference between MDB and JMS

Please let me know what is the difference between:

Upvotes: 8

Views: 13188

Answers (2)

duffymo
duffymo

Reputation: 308803

JMS is the Java Messaging Service specification; it's the API for queues and topics in Java EE.

The MDBs that I'm familiar with typically implement the javax.jms.MessageListener interface, encapsulating the topic or queue listener into a component that's managed by the Java EE container.

But it's been pointed out to me in the comments that this is not a requirement; MDBs can be used as part of the Java Connector API.

Upvotes: 2

skaffman
skaffman

Reputation: 403501

JMS and Message-driven beans are not either/or choice, the two are complimentary.

JMS is the API and technology for passing messages around. Message-driven beans (MDB) are an API for receiving JMS messages as events in the EJB style. There are many ways of handling JMS messages, MDB is just one of them.

From the JavaEE tutorial:

Message-driven beans can implement any messaging type. Most commonly, they implement the Java Message Service (JMS) technology.

Your subject, by the way, talks abut MBeans - this is entirely different (that refers to the JMX API), and nothing to do with JMS.

Upvotes: 12

Related Questions