You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by quoc_thai <do...@yahoo.com.vn> on 2010/10/18 09:58:52 UTC
Create durable topic subscriber ?
Hi all,
From the
http://activemq.apache.org/how-do-durable-queues-and-topics-work.html
http://activemq.apache.org/how-do-durable-queues-and-topics-work.html
I want create a durable topic subscriber but at the consumer, I receive
some error "You cannot create a durable subscriber without specifying a
unique clientID on a Connection"
At the consumer, my code fragment:
------------------------
Topic topic = consumer.getSession().createTopic("STOCKS." + stock);
TopicSubscriber consumer =
consumer.getSession().createDurableSubscriber(topic,"myDurable1");
consumer.setMessageListener(new Listener());
------------------------
Can show me some code fragments to create durable topic ?
Thanks.
--
View this message in context: http://activemq.2283324.n4.nabble.com/Create-durable-topic-subscriber-tp2999808p2999808.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Create durable topic subscriber ?
Posted by quoc_thai <do...@yahoo.com.vn>.
Thanks ! I had called Connection.setClientID(String) before I called
Connection.CreateDurableConnectionConsumer(). Something's ok !
--
View this message in context: http://activemq.2283324.n4.nabble.com/Create-durable-topic-subscriber-tp2999808p3001334.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Create durable topic subscriber ?
Posted by Joe Niski <jo...@NWEA.org>.
i did some exploratory testing around this issue when diagnosing problems i had with Durable Subscriptions.
ActiveMQ (5.3.0) appears to set aClient ID for the first Connection returned from a ConnectionFactory, but not on subsequent Connections. The ID is constructed from the broker ID, i believe.
But you can call Connection.setClientID(String) to set it yourself, before calling Connection.CreateDurableConnectionConsumer().
Joe Niski
IS Development | NWEA
PHONE 503.212.3382 | FAX 503.639.7873
NWEA.ORG<3D%22http://www.nwea.org/%22> | Partnering to Help All Kids Learn
On 10/18/2010 12:58 AM, quoc_thai wrote:
Hi all,
From the
http://activemq.apache.org/how-do-durable-queues-and-topics-work.html
http://activemq.apache.org/how-do-durable-queues-and-topics-work.html
I want create a durable topic subscriber but at the consumer, I receive
some error "You cannot create a durable subscriber without specifying a
unique clientID on a Connection"
At the consumer, my code fragment:
------------------------
Topic topic = consumer.getSession().createTopic("STOCKS." + stock);
TopicSubscriber consumer =
consumer.getSession().createDurableSubscriber(topic,"myDurable1");
consumer.setMessageListener(new Listener());
------------------------
Can show me some code fragments to create durable topic ?
Thanks.
--
View this message in context: http://activemq.2283324.n4.nabble.com/Create-durable-topic-subscriber-tp2999808p2999808.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.