Difference between MDB and JMS
Please let me know what is the difference betwee开发者_JAVA技巧n:
- Message Driven Beans (MDB)
- Java Message Service (JMS)
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.
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.
精彩评论