O'Reilly logo

Java Message Service by Richard Monson-Haefel, David A Chappell

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

Publish-and-Subscribe API

This section covers the topic-based API.

TemporaryTopic

A TemporaryTopic is created by a TopicSession. A temporary topic is associated with the connection that belongs to the TopicSession that created it. It is only active for the duration of the session's connection, and it is guaranteed to be unique across all connections. Since it is temporary it can't be durable—it lasts only as long as its associated client connection is active. In all other respects it is just like a "regular" topic. The TemporaryTopic is a subtype of the Topic interface.

Since a temporary topic is created by a JMS client, it is unavailable to other JMS clients unless the topic identity is transferred using the JMSReplyTo header. While any client may publish messages on another client's temporary topic, only the sessions that are associated with the JMS client connection that created the temporary topic may subscribe to it. JMS clients can also, of course, publish messages to their own temporary topics:

public interface TemporaryTopic extends Topic {
    public void delete(  ) throws JMSException;
}

Topic

The Topic is an administered object that acts as a handle or identifier for an actual topic, called a physical topic, on the messaging server. A physical topic is a channel to which many clients can subscribe and publish. When a JMS client delivers a Message object to a topic, all the clients subscribed to that topic receive the Message. The Topic is a subtype of the Destination interface: ...

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