简体   繁体   中英

What is the difference between JMS consumer and Message Driven Beans (MDB)

Is there any difference between an asynchronous JMS (Java Messaging Service) consumer vs an actual MDB (Message Driven Bean). The only difference I see is the MDB class has @MessageDriven annotation which the asynchronous JMS consumer doesn't.

Anything else that I am missing ?

Your MDB works as JMS consumer in your case. MDB is EJB specific term and consumer is a JMS term. A JMS consumer can be a message driven POJO as well which is not technically an EJB.

Answers to comments

A1. Yes it is correct to say that a plain JMS consumer cannot be pooled/managed like an EJB unless that JMS consumer happens to be managed by containers like EJB or Spring containers.

A2. MDBs really just fulfills the requirement for asynchronous communication with EJBs. When they are JMS based then your MDB is technically a JMS Consumer as well. But an MDB can be non-JMS based as well eg: JCA (Java Connector Architecture) based MDB. You can see this post for more details about non-JMS based MDB: http://debupanda.blogspot.com/2006/08/using-ejb-30-message-driven-bean-with.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM