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. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access