How to create a JMS durable subscriber in WebLogic Server?
Posted
by lmestre
on Oracle Blogs
See other posts from Oracle Blogs
or by lmestre
Published on Tue, 27 May 2014 00:47:17 +0000
Indexed on
2014/05/27
3:37 UTC
Read the original article
Hit count: 215
/Oracle
Here you can check how to install the examples:
http://docs.oracle.com/cd/E23943_01/doc.1111/e14142/prepare.htm
After you have installed the examples, you can find the example you want to review, in this case TopicReceive, here:
wlserver_10.3/samples/server/examples/src/examples/jms/topic
To review details of the specific example, you can open:
wlserver_10.3/samples/server/examples/src/examples/jms/topic/instructions.html
To create a Durable Subscriber, you can just set the client ID and invoke createDurableSubscriber instead of calling createSubscriber, i.e.:
tconFactory = (TopicConnectionFactory)
PortableRemoteObject.narrow(ctx.lookup(JMS_FACTORY),
TopicConnectionFactory.class);
tcon = tconFactory.createTopicConnection();
//Set Client ID for this Durable Subscriber
tcon.setClientID("GT2");
tsession = tcon.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
topic = (Topic)
PortableRemoteObject.narrow(ctx.lookup(topicName),
Topic.class);
// Create Durable Subscription
tsubscriber = tsession.createDurableSubscriber(topic, "Test");
tsubscriber.setMessageListener(this);
tcon.start();
Enjoy!
You can read more about this here:
http://docs.oracle.com/cd/E23943_01/web.1111/e13727/advpubsub.htm#CHDEBABC
http://docs.oracle.com/cd/E23943_01/web.1111/e13727/manage_apps.htm#i1097671
http://docs.oracle.com/cd/E23943_01/apirefs.1111/e13943/WebLogic.Messaging.ISession.CreateDurableSubscriber_overload_2.html
© Oracle Blogs or respective owner