20.1. Writing a Message-Driven Bean
When we introduced JMS in Chapter 12, we made a version of the Standings class the recipient of the messages. Because we've already reworked the Standings class as a session bean, I decided to focus on the Games class for the message-driven bean example. The net effect is identical: Games can be added to the game list by either object, but the Standings object is always just passing these updates through to the Games object anyway, so having the Games object receive updates directly is actually a small optimization.
Our GamesMessageBean includes both familiar and unfamiliar pieces. What is familiar is the implementation of the javax.jms.MessageListener interface, and the inclusion of an onMessage() call that ...
Get J2EE™ and JAX™: Developing Web Applications and Web Services 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.