12.7. A JMS Subscriber

Our JMSGameServer is a JMS publisher; now we need to see what the subscriber for this service would look like. Listing 12.3 shows the JMSStandingsImpl class. In this class, we extend the DynamicStandingsImpl class that provides the application behavior we need. We also implement the javax.jms.MessageListener interface, which requires that we implement a single method, onMessage(), which will be invoked by the JMS messaging provider whenever a message is ready to be delivered to us.

Much of the code in this class is the same as in the GameServer. We follow the same procedure to find the messaging provider using the JNDI. We also use the same code to create TopicConnectionFactory, TopicConnection, and TopicSession objects. ...

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.