Third. Message Drive Beans Introduction Asynchronous Messages can also be implemented by messaging. Two types of EJB are defined in the EJB 1.1 specification. They are entity beans and session beans. The client is usually tuned by synchronous, blocked mode. Message Drive Beans combine EJB and JMS functions. As mentioned above, session beans are usually realizing business logic, and the client cannot share a session beans. Subductions are typically corresponding to some entity entries in permanent storage. Both beans usually have Remote and Home interfaces to interact with the client. Also, these interactions are synchronized, blocked. For example, a request is sent to a bean, and the server returns a corresponding. The caller can proceed to the next step after receiving the return. Message Drive Beans is typically configured to be a special subject (Topic) or queue client as a user. But the message driver does not have a Home and Remote interface. When a message generator writes a message to Topic or queue, I don't know if the user is a message driver. This allows integrated distributed computing systems, there is a lot of flexibility. The message driver does not have a state of the session property, and all instances are the same when the request is not processed, which is similar to the stateless sessile. Place an instance of the beans in the buffer pool and a method of efficiently handling message drivers. A message drive beans must be indirectly or directly inherited from the Javax.ejb.MessageDriveNbean interface. This interface is inherited by javax.jms.MessageListener. One parameter of this method is javax.jms.Message. Can be any effective JMS message type. A THROWN statement does not include a statement of the method. Therefore, in the message processing, it will not still be abnormal. When the container receives a message, it is first obtained from a buffer pool to a ready-made message driving beans, and then if the configuration file is required, the container also sets a connection to the transaction context. When these management tasks are completed, the received messages are delivered to the onMessage () method. Once the method is completed, the transaction is confirmed or returned, the beans are resended back to the buffer pool. EJBREMOVE () calls when the message driver is deleted from any storage. And make clear operations and garbage collection. The resources for all beans must be released in the EJBREMOVE () method. The setMessageDrivenConnection () method has only one parameter -Javax.ejb.MessageDrivenContext instance. The MessageDrivenContext class is similar to the context in the entity and session beans. When an instance of a bean is created, the container is incorporated into the context of the beans. The method of obtaining environmental information in context, and the JTA UserTranscation class, which is used for the occasion of beans management transaction processing. In addition, the bean provider must provide an ejbcreate () method (no parameters) for setting the beans on the EJB server. Bean instances can achieve any resources needed in the EJBCREATE () method. Message Drive Great simplifies the creation of a JMS user, created and configure a JMS message user, which is made to the EJB container. Developers only need to simply implement the interface driven interface, configure it to the EJB server to create a business logic component that receives messages. IV. One example This article describes the above concept, writes a message driven beans, a Publisher and a subscriber code. Let's talk about how to run an example. Here, it is assumed that the reader has downloaded J2EE SDK 1.3 Bate from the Sun home page and is already installed.