10.5. Sending messages from EJBs
The process of sending JMS messages from an EJB will be illustrated using the example of LegacyMessager from the Prestige Bike Hire application. This EJB has one exposed method: dispatchToQueue(), which takes as arguments information about the customer (including credit card details) and the amount of money to be charged. This method is called by makeReservation() in the BookingManager EJB when the customer makes a reservation. This latter method also creates an instance of Booking to represent a new booking.
Note that the update of the database (that is, creating a Booking EJB) and the delivery of the message to the queue constitute a transaction. If the message can’t be delivered, we want the database to be ...
Get Applied Enterprise JavaBeans™ Technology now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.