Play and learn 300 000+ tabs online

Wednesday, January 20, 2010

Message Driven in JAVA JMS

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.
The goal of the message-driven bean model is to make developing an enterprise bean that is asynchronously 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 addition to JMS, and to allow for message-driven beans that are written to their APIs.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.