Chapter WORKBOOK 10. Exercises for Chapter 12
Exercise 12.1: The Message-Driven Bean
In this exercise, we will build the same ReservationProcessor MDB described in Chapter 12. The ReservationProcessor MDB plays the same role as the TravelAgent EJB, but it receives its booking orders through a JMS queue rather than a synchronous remote interface.
To test the MDB, a new client application makes multiple reservations in batch mode, using a JMS queue that’s bound to the MDB. A second client application listens on another queue to receive booking confirmation messages.
Along the way, you’ll learn how to create a new JMS queue in JBoss and configure a message-driven bean.
Start Up JBoss
If you already have JBoss running, there is no reason to restart it. Otherwise, start it up as instructed in Workbook 1.
Initialize the Database
The database tables will be created when Exercise 12.1 is deployed
to JBoss. If you have problems running this example, shut down JBoss
and run the
Create a New JMS Queue
This exercise requires two different JMS queues: one for the ReservationProcessor MDB and one to receive booking confirmations.
Adding new JMS queues to JBoss is much like adding new JMS topics. As in the exercises in earlier chapters of this workbook, you have two options: one involving a configuration file, the other involving the JMX HTTP connector.
Adding a JMS queue through a configuration file
Adding new JMS queues to JBoss is much like adding new JMS topics. The most common way ...