You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Nicky Sandhu <ni...@hotmail.com> on 2007/06/07 00:46:04 UTC

Durable subscribe to topic

How do I do a durable subscribe to a topic?
e.g. from("myjms:topic:default.topic").to(...
The first step that i can glean from source is to connect to instance of
active mq like this ?
ConnectionFactory connectionFactory=new
ActiveMQConnectionFactory("tcp://localhost:61616?clientId=camel&durableSubscriptionName=simple.q2q&deliveryPersistent=true");

but then how should the property on the endpoint be set to create a durable
subscribe to the topic?
-- 
View this message in context: http://www.nabble.com/Durable-subscribe-to-topic-tf3880838s22882.html#a10998769
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Durable subscribe to topic

Posted by Hiram Chirino <hi...@hiramchirino.com>.
Good question!  I'd have to dig a little but I'm sure that there is a
way to do it.  But since it is a good question.  Could you open a
issue at

http://issues.apache.org/activemq/browse/CAMEL

So that we don't forget to create an example of how to do this.

Thanks,
Hiram

On 6/6/07, Nicky Sandhu <ni...@hotmail.com> wrote:
>
> How do I do a durable subscribe to a topic?
> e.g. from("myjms:topic:default.topic").to(...
> The first step that i can glean from source is to connect to instance of
> active mq like this ?
> ConnectionFactory connectionFactory=new
> ActiveMQConnectionFactory("tcp://localhost:61616?clientId=camel&durableSubscriptionName=simple.q2q&deliveryPersistent=true");
>
> but then how should the property on the endpoint be set to create a durable
> subscribe to the topic?
> --
> View this message in context: http://www.nabble.com/Durable-subscribe-to-topic-tf3880838s22882.html#a10998769
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Re: Durable subscribe to topic

Posted by James Strachan <ja...@gmail.com>.
On 6/6/07, Nicky Sandhu <ni...@hotmail.com> wrote:
>
> How do I do a durable subscribe to a topic?
> e.g. from("myjms:topic:default.topic").to(...
> The first step that i can glean from source is to connect to instance of
> active mq like this ?
> ConnectionFactory connectionFactory=new
> ActiveMQConnectionFactory("tcp://localhost:61616?clientId=camel&durableSubscriptionName=simple.q2q&deliveryPersistent=true");
>
> but then how should the property on the endpoint be set to create a durable
> subscribe to the topic?

The trick is to specify those query arguments on the endpoint URI
rather than the connection factory.

So

from("jms:topic:myTopic?clientId=camel&durableSubscriptionName=simple.q2q&deliveryPersistent=true").to(.....)

FWIW persistence is the default delivery mode in JMS, so you only
really need to specify it if you wish to disable persistence.

I spotted that there was a bug in the URI handling code if the URI
doesn't have the // notation the query arguments were ignored. So the
above had to be done as

jms://topic:myTopic?clientId=camel&durableSubscriptionName=simple.q2q

I've just fixed this oversight so that the following will also work...

jms:topic:myTopic?clientId=camel&durableSubscriptionName=simple.q2q

Incidentally here's the test case that shows that this URI mechanism
does in fact configure the underlying durable subscriber and client ID
in the Spring message listener container thats used...

http://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java

Since all this stuff was a little murky and non-obvious I've updated
the wiki with much more detailed information on configuration...
http://cwiki.apache.org/CAMEL/jms.html

-- 
James
-------
http://macstrac.blogspot.com/