Day 10. Message-Driven Beans

So far, you have looked at two types of Enterprise JavaBeans (EJB)—the Session bean and the Entity bean. Today you will consider the third and final EJB, the Message-Driven bean. The following topics are covered:

  • Similarities and differences with Entity and Session beans

  • The life-cycle of a Message-Driven bean

  • Writing a Message-Driven bean

Prior to the EJB 2.0 specification, it was not possible to support asynchronous message passing. All EJB method calls had to be synchronous and initiated by the client.

With J2EE 1.3 and later versions, you can use Message-Driven beans to combine the functionality of EJBs with the Java Message Service (JMS) to support asynchronous communication.

Although JMS was covered in detail on Day 9, “Java Message Service,” the following is a quick recap of its main features:

  • JMS is a Java API that specifies how applications can create, send, receive, and read messages.

  • JMS enables communication that is both asynchronous and reliable, while minimizing the amount of knowledge and programming required.

  • The implementation of the JMS API is provided by a number of vendors known as Message Service providers.

  • Message queues are associated with the point-to-point message domain. Messages in a queue are normally persistent but can only be consumed by one receiver.

  • Topics allow a message to be sent to more than one receiver (called a subscriber). Messages are not normally persistent; they are immediately delivered to all existing subscribers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.216.160