O'Reilly logo

J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software by Art Taylor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Publish and Subscribe Messaging

As discussed at the beginning of this chapter, publish and subscribe messaging provides an alternative method of loosely coupled component interaction. In the following example, a message client sends a request for information on particular movies. As shown previously with the message queue example, the message is in an XML format, so parsing and processing the message is made simpler.

Creating a publish and subscribe client is similar to creating a message queue client. But instead of sending the message to a queue, we will publish it to a topic. The following code example demonstrates this process.

The JMSClientPS Class
 package examples.jms; import java.util.*; import javax.naming.*; import javax.jms.*; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required