|
Summary: A JMS client subscribes to a topic with a TopicSubscriber.
OverviewA JMS client subscribes to a topic with a TopicSubscriber, created from the TopicSession object using one of a diversity of methods. Choose a certain method depending on:
The most conventional method to create a non-durable subscription is: TopicSubscriber createSubscriber(Topic topic) // topicSession is an instance of TopicSession // topic is an instance of Topic TopicSubscriber subscriber = topicSession.createSubscriber(topic); To specify a message selector, use the following text string that defines the criteria needed to filter incoming messages. TopicSubscriber createSubscriber(Topic topic, String messageSelector, Boolean nolocal)
To create a durable subscription according to JMS specifications, use either of the following two methods: TopicSubscriber createDurableSubscriber(Topic topic, String subscriptionName) TopicSubscriber createDurableSubscriber(Topic topic, String subscriptionName,String messageSelector, Boolean nolocal)
After you've created a TopicPublisher, you can receive messages, either synchronously or asynchronously. |
Wiki Content Tree
Your Feedback Needed!
We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.
Add Comment