Can someone tell me what's the difference between a Message Queue and Message driven bean ? how do they interact with each other ?
Joined: Oct 24, 2005
A message queue is a data struture used for holding messages. Think of it like a list where you can push items onto the list and pop items off the list.
A message driven bean is a special type of EJB that is used to listen for messages on a messsage queue , take the message from the queue and perform some processing on the message. All this typically runs as a transaction which allows you to roll the message back on the queue under certain failure scenarios.
You create a queue manager in IBM MQ and create queues associated with this queue manager. Applications write messages to these queues by using API calls like JMS. In you JEE application you will have written a message driven bean , this bean will process messages put to the queue. The bean will be configured to use a javax.jms.QueueconnectionFactory which is a configuration setting in WebSphere that represents connection details to the MQ queue manager and a javax.jms.Queue object which is a configuration in websphere that represents the actual queue associated with a queue manager in MQ.