Message Driven Beans

A message-driven bean is an asynchronous message consumer. A message-driven bean is invoked by the container as a result of the arrival of a JMS message. A message-driven bean has neither a home nor a remote interface. A message-driven bean instance is an instance of a message-driven bean class. To a client, a message-driven bean is a JMS message consumer that implements some business logic running on the server. A client accesses a message-driven bean through JMS by sending messages to the JMS Destination (Queue or Topic) for which the message-driven bean class is the MessageListener. Message-driven bean instances have no conversational state. This means that all bean instances are equivalent when they are not involved in servicing a client message. Message-driven beans are anonymous. They have no client-visible identity. A message-driven bean instance is created by the container to handle the processing of the messages for which the message-driven bean is the consumer. Its lifetime is controlled by the container. A message-driven bean instance has no state for a specific client. However, the instance variables of the message-driven bean instance can contain state across the handling of client messages. Examples of such state include an open database connection and an object reference to an EJB object.


Goals

The goal of the message-driven bean model is to make developing an enterprise bean that is asynchro-nously invoked to handle the processing of incoming JMS messages as simple as developing the same functionality in any other JMS MessageListener.
A further goal of the message-driven bean model is to allow for the concurrent processing of a stream of messages by means of container-provided pooling of message-driven bean instances.
While the EJB 2.0 specification requires support for only JMS-based messaging, a future goal
of the message-driven bean model is to provide support for other types of messaging in addi-tion
to JMS, and to allow for message-driven beans that are written to their APIs.

1 comment:

Galia Co Hagan said...

Thanks for the post, I am techno savvy. I believe you hit the nail right on the head. I am highly impressed with your blog. It is very nicely explained. Your article adds best knowledge to our Java EE Training in Chennai. or learn thru Java EE Training in Chennai Students.