[activemq-dev] sample example and durable messages

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[activemq-dev] sample example and durable messages

Padmaja Pradhan
Hi,
 
I have the activemq downloaded and installed. I am mainly interested in durable messages. When running the sample examples, I run the producer first and then the consumer. If the topic flag in build.xml is set to false, then the consumer receives the messages ( durable behavior). However, if topic flag is set to true ( in which case we are using durableTopicSubscriber), then I run the producer first and then start the consumer, it just stays in waiting state. This should not be the case as per the specs, I am setting durable= true.
 
Am I wrong in my assumptions about JMS? It should be possible to have durable messaging with both queue and topic, right?
 
Thanks
-Padmaja

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
Reply | Threaded
Open this post in threaded view
|

Re: [activemq-dev] sample example and durable messages

James Strachan-2

On 26 Aug 2005, at 18:54, Padmaja Pradhan wrote:

> Hi,
>
> I have the activemq downloaded and installed. I am mainly  
> interested in durable messages. When running the sample examples, I  
> run the producer first and then the consumer. If the topic flag in  
> build.xml is set to false, then the consumer receives the messages  
> ( durable behavior). However, if topic flag is set to true ( in  
> which case we are using durableTopicSubscriber), then I run the  
> producer first and then start the consumer, it just stays in  
> waiting state. This should not be the case as per the specs, I am  
> setting durable= true.
>
> Am I wrong in my assumptions about JMS? It should be possible to  
> have durable messaging with both queue and topic, right?

Definitely.

Durability is defined by the MessageProducer's deliveryMode property.

However there is a big difference between queues and topics. For  
queues a single message sits on a queue until its consumed,  
irrespective of the consumers. For topics, a message is only kept  
around or delivered if there are any subscribers active. For durable  
topic subscribes that means you have to start the consumer first, to  
activate the durable subscription. Then you can close it, then  
publish messages, then restart the consumer (with the same clientID  
and subscriberName) and you'll get the messages.

James
-------
http://radio.weblogs.com/0112098/

Reply | Threaded
Open this post in threaded view
|

Re: [activemq-dev] sample example and durable messages

Padmaja Pradhan
Now I get it. It works exacty as you said. The broker has to know about the durable subscription beforehand to keep the published messages around.
 
Thank you so much
-Padmaja

James Strachan <[hidden email]> wrote:

On 26 Aug 2005, at 18:54, Padmaja Pradhan wrote:

> Hi,
>
> I have the activemq downloaded and installed. I am mainly
> interested in durable messages. When running the sample examples, I
> run the producer first and then the consumer. If the topic flag in
> build.xml is set to false, then the consumer receives the messages
> ( durable behavior). However, if topic flag is set to true ( in
> which case we are using durableTopicSubscriber), then I run the
> producer first and then start the consumer, it just stays in
> waiting state. This should not be the case as per the specs, I am
> setting durable= true.
>
> Am I wrong in my assumptions about JMS? It should be possible to
> have durable messaging with both queue and topic, right?

Definitely.

Durability is defined by the MessageProducer's deliveryMode property.

However there is a big difference between queues and topics. For
queues a single message sits on a queue until its consumed,
irrespective of the consumers. For topics, a message is only kept
around or delivered if there are any subscribers active. For durable
topic subscribes that means you have to start the consumer first, to
activate the durable subscription. Then you can close it, then
publish messages, then restart the consumer (with the same clientID
and subscriberName) and you'll get the messages.

James
-------
http://radio.weblogs.com/0112098/


               
---------------------------------
 Start your day with Yahoo! - make it your home page
Reply | Threaded
Open this post in threaded view
|

Re: [activemq-dev] sample example and durable messages

James Strachan-2

On 26 Aug 2005, at 19:08, Padmaja Pradhan wrote:

> Now I get it. It works exacty as you said. The broker has to know  
> about the durable subscription beforehand to keep the published  
> messages around.
>
> Thank you so much

You're welcome! :)

James
-------
http://radio.weblogs.com/0112098/