activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <rajdav...@gmail.com>
Subject Re: Consuming persistent messages from a non-durable subscriber
Date Mon, 31 Mar 2008 08:19:54 GMT

On 28 Mar 2008, at 09:42, Ramit Arora wrote:

>
> Hi All,
> I have a situation where I have to consume persisent messages from  
> many
> non-durable subscribers. My publishers push persistent messages to a  
> topic,
> which are consumed asynchronously by non-durable subscribers. I am  
> using the
> AMQ Persistence Adapter & CLIENT_ACKNOWLEDGE. If I kill a non-durable
> subscriber & bring it up again, some messages are lost, which is  
> expected.
> But consider the following case:
> 1. Start a publisher publishing persistent messages to a topic.
> 2. Start a non-durable subscriber which is slow compared to the  
> publisher.
> 3. Kill the broker when 100 messages have been published but only 50  
> have
> been consumed.
> 4. Since the publisher & subscriber are failover clients, they wait  
> for the
> broker to come up again.
> 5. Restart the broker.
> 6. Try to get the remaining 50 messages to the non-durable subscriber.
>
> Step 6 does not work in both 5.0 & the latest 5.1 snapshot.  
> Shouldn't the
> remaining 50 messages be delivered? The JMS spec says:
> "A JMS provider must deliver a PERSISTENT message once-and-only- 
> once. This
> means a JMS provider failure must not cause it to be lost, and it  
> must not
> deliver it twice. PERSISTENT (once-and-only-once) and NON_PERSISTENT
> (at-most-once)
> message delivery are a way for a JMS client to select between delivery
> techniques that may lose a messages if a JMS provider dies and those  
> which
> take extra effort to insure that messages can survive such a  
> failure. There
> is
> typically a performance/reliability trade-off implied by this  
> choice. When a
> client selects the NON_PERSISTENT delivery mode, it is indicating  
> that it
> values performance over reliability; a selection of PERSISTENT  
> reverses the
> requested trade-off."
>
> Queues donot suffer from this problem. Please let me know if I am  
> missing
> something.
>
> Thanks,
> Ramit
>
>
> -- 
> View this message in context: http://www.nabble.com/Consuming-persistent-messages-from-a-non-durable-subscriber-tp16348721s2354p16348721.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>


Message delivery by default is persistent - but there is a fundamental  
difference in the contract between queues and topics:
Queue messages are always persisted
Topic messages are persisted if there exists a durable subscriber for  
that topic.
You can get around this by using virtual destinations - see here: http://activemq.apache.org/virtual-destinations.html

cheers,

Rob

Mime
View raw message