Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 655
Robin Bajaj Avatar asked Apr 13 '11 21:04

Robin Bajaj


1 Answers

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

like image 79
anubhava Avatar answered Sep 16 '22 23:09

anubhava