Publish-and-Subscribe API
This section covers the topic-based publish-and-subscribe interfaces and classes.
TemporaryTopic
A TemporaryTopic is created
by a TopicSession or Session. 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 ...