Durable subscribe to topic

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Durable subscribe to topic

Nicky Sandhu
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?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Durable subscribe to topic

Hiram Chirino
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 <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Durable subscribe to topic

jstrachan
In reply to this post by Nicky Sandhu
On 6/6/07, Nicky Sandhu <[hidden email]> 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/
Loading...