|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A TopicSession provides methods for creating TopicPublisher's, TopicSubscriber's and TemporaryTopics. It also provides a method for deleting its client's durable subscribers.
Session
,
TopicConnection.createTopicSession(boolean, int)
,
XATopicSession.getTopicSession()
Fields inherited from interface javax.jms.Session |
AUTO_ACKNOWLEDGE,
CLIENT_ACKNOWLEDGE,
DUPS_OK_ACKNOWLEDGE |
Method Summary | |
TopicSubscriber |
createDurableSubscriber(Topic topic,
java.lang.String name)
Create a durable Subscriber to the specified topic. |
TopicSubscriber |
createDurableSubscriber(Topic topic,
java.lang.String name,
java.lang.String messageSelector,
boolean noLocal)
Create a durable Subscriber to the specified topic. |
TopicPublisher |
createPublisher(Topic topic)
Create a Publisher for the specified topic. |
TopicSubscriber |
createSubscriber(Topic topic)
Create a non-durable Subscriber to the specified topic. |
TopicSubscriber |
createSubscriber(Topic topic,
java.lang.String messageSelector,
boolean noLocal)
Create a non-durable Subscriber to the specified topic. |
TemporaryTopic |
createTemporaryTopic()
Create a temporary topic. |
Topic |
createTopic(java.lang.String topicName)
Create a topic identity given a Topic name. |
void |
unsubscribe(java.lang.String name)
Unsubscribe a durable subscription that has been created by a client. |
Methods inherited from interface javax.jms.Session |
close,
commit,
createBytesMessage,
createMapMessage,
createMessage,
createObjectMessage,
createObjectMessage,
createStreamMessage,
createTextMessage,
createTextMessage,
getMessageListener,
getTransacted,
recover,
rollback,
run,
setMessageListener |
Method Detail |
public Topic createTopic(java.lang.String topicName) throws JMSException
This facility is provided for the rare cases where clients need to dynamically manipulate topic identity. This allows the creation of a topic identity with a provider specific name. Clients that depend on this ability are not portable.
Note that this method is not for creating the physical topic. The physical creation of topics is an administration task and not to be initiated by the JMS interface. The one exception is the creation of temporary topics is done using the createTemporaryTopic method.
topicName
- the name of this topicpublic TopicSubscriber createSubscriber(Topic topic) throws JMSException
A client uses a TopicSubscriber for receiving messages that have been published to a topic.
Regular TopicSubscriber's are not durable. They only receive messages that are published while they are active.
In some cases, a connection may both publish and subscribe to a topic. The subscriber NoLocal attribute allows a subscriber to inhibit the delivery of messages published by its own connection. The default value for this attribute is false.
topic
- the topic to subscribe topublic TopicSubscriber createSubscriber(Topic topic, java.lang.String messageSelector, boolean noLocal) throws JMSException
A client uses a TopicSubscriber for receiving messages that have been published to a topic.
Regular TopicSubscriber's are not durable. They only receive messages that are published while they are active.
Messages filtered out by a subscriber's message selector will never be delivered to the subscriber. From the subscriber's perspective they simply don't exist.
In some cases, a connection may both publish and subscribe to a topic. The subscriber NoLocal attribute allows a subscriber to inhibit the delivery of messages published by its own connection.
topic
- the topic to subscribe tomessageSelector
- only messages with properties matching the
message selector expression are delivered. This value may be null.noLocal
- if set, inhibits the delivery of messages published
by its own connection.public TopicSubscriber createDurableSubscriber(Topic topic, java.lang.String name) throws JMSException
If a client needs to receive all the messages published on a topic including the ones published while the subscriber is inactive, it uses a durable TopicSubscriber. JMS retains a record of this durable subscription and insures that all messages from the topic's publishers are retained until they are either acknowledged by this durable subscriber or they have expired.
Sessions with durable subscribers must always provide the same client identifier. In addition, each client must specify a name which uniquely identifies (within client identifier) each durable subscription it creates. Only one session at a time can have a TopicSubscriber for a particular durable subscription.
A client can change an existing durable subscription by creating a durable TopicSubscriber with the same name and a new topic and/or message selector. Changing a durable subscriber is equivalent to unsubscribing(deleting) the old one and creating a new one.
topic
- the non-temporary topic to subscribe toname
- the name used to identify this subscription.public TopicSubscriber createDurableSubscriber(Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal) throws JMSException
If a client needs to receive all the messages published on a topic including the ones published while the subscriber is inactive, it uses a durable TopicSubscriber. JMS retains a record of this durable subscription and insures that all messages from the topic's publishers are retained until they are either acknowledged by this durable subscriber or they have expired.
Sessions with durable subscribers must always provide the same client identifier. In addition, each client must specify a name which uniquely identifies (within client identifier) each durable subscription it creates. Only one session at a time can have a TopicSubscriber for a particular durable subscription. An inactive durable subscriber is one that exists but does not currently have a message consumer associated with it.
A client can change an existing durable subscription by creating a durable TopicSubscriber with the same name and a new topic and/or message selector. Changing a durable subscriber is equivalent to unsubscribing(deleting) the old one and creating a new one.
topic
- the non-temporary topic to subscribe toname
- the name used to identify this subscription.messageSelector
- only messages with properties matching the
message selector expression are delivered. This value may be null.noLocal
- if set, inhibits the delivery of messages published
by its own connection.public TopicPublisher createPublisher(Topic topic) throws JMSException
A client uses a TopicPublisher for publishing messages on a topic. Each time a client creates a TopicPublisher on a topic, it defines a new sequence of messages that have no ordering relationship with the messages it has previously sent.
topic
- the topic to publish to, or null if this is an
unidentifed producer.public TemporaryTopic createTemporaryTopic() throws JMSException
public void unsubscribe(java.lang.String name) throws JMSException
This deletes the state being maintained on behalf of the subscriber by its provider.
It is erroneous for a client to delete a durable subscription while it has an active TopicSubscriber for it, or while a message received by it is part of a transaction or has not been acknowledged in the session.
name
- the name used to identify this subscription.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |