In this chapter, we will look at the integration of JMS with another J2EE technology, that of Enterprise JavaBeans (EJB). At the time of writing there are two different versions of the EJB specification in use (1.1 and 2.0, which is in proposed-final draft stage), each of which requires a different approach to JMS integration.
We will cover the use of JMS with both EJB 1.1, and EJB 2.0 using the new message-driven bean functionality introduced in the EJB 2.0 specification. To do so, we will take the Case Logging application from the previous chapter and extend it to include integration with an EJB. We will modify the application such that messages are published to a topic, where they are picked up by an EJB, which send an e-mail, via JavaMail, to a user of the Case Management system.
In this chapter we will:
Look at the difficulties (prior to EJB 2.0) in using EJBs as JMS consumers
Develop a solution for integrating JMS with EJB 1.1
Replicate this same functionality with an EJB 2.0 message-driven bean to show how the new EJB 2.0 specification simplifies things for us
Note | This chapter assumes that you are familiar with EJB 1.1 development. If you are not, we recommend you take a look at Professional Java Server Programming -J2EE Edition from Wrox Press ISBN 1-861004-65-6, for a quick tutorial in their use. |