You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by johnd <jl...@gmail.com> on 2014/01/22 18:45:45 UTC

Persistent messages moving to DLQ when consumer not active

Hi,

I have an issue where persistent messages on a queue are being moved to the
DLQ when there is no active consumer on the queue. I am not sure if this is
an issue with activeMQ or Camel.

The set-up is as follows: messages or put onto a queue in an embedded broker
which is bridged to a standalone broker. From here, it is first routed to a
topic, and from there onto one or more queues to be processed by the
consumers. This works ok when all components are active, but if the
consumers are down then I can see the message appear on the queue and then
get moved to the DLQ a few seconds later. Why is this - why do the messages
not stay in the queue to be picked-up by the consumers when they are active?

The producer (JmsTemplate) is set to persistent delivery with a timeToLive
set to 691200000, and I have tried with explicitQosEnabled set to both true
and false:


Camel routes are:



So, when there is no consumer on the Client1.Events or Client2.Events
queues, the messages get moved to the DLQ. Why is this? What do I have to
do/set for the messages to stay on this queue until they are picked-up by a
consumer?

>From monitoring (using ActiveMW web console) the queues, I can see that it
takes approx 30 seconds for the message to be moved to the DLQ (default
message ttl?). However, if I bring up a consumer on the queue before this
time, it seems that the message is moved to the DLQ as soon as (or just
before) the consumer connects to the queue.

The following messages are logged when the broker moves the messages to the
DLQ:




Note that the "expiration" time is 1390408849014 (1 second after the
timestamp), so it looks like the time-to-live that I have set is being lost
somewhere in transit. Is this not preserved automatically when routed?
I have also tried adding 'preserveMessageQos=true' to all the camel routes,
e.g


This does not seem to make any difference.

Do I need to configure the consumer somehow to let the broker know to
deliver old (i.e. those put on the queue before the consumer is started)
messages?

I think i have provided all the relevant information - let me know if you
need to know anything else.

Thanks in advance,

John



--
View this message in context: http://activemq.2283324.n4.nabble.com/Persistent-messages-moving-to-DLQ-when-consumer-not-active-tp4676652.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Persistent messages moving to DLQ when consumer not active

Posted by artnaseef <ar...@artnaseef.com>.
Awesome. Knowing the final outcome  helps in case this ever pops up again. 


Sent from my iPhone

> On Jan 24, 2014, at 7:51 AM, "johnd [via ActiveMQ]" <ml...@n4.nabble.com> wrote:
> 
> artnaseef wrote
> Cool - you're welcome. 
> 
> Note that plugin may be valuable if your broker clocks ever get far out-of-sync, so you might want to look more closely at why the plugin was whacking the timeouts.  Note that I'm saying this with only a brief look at that code, so I can't say for sure right now that it can work the way you need.
> Both brokers on the same machine (at the moment!) so not an issue. I'll bare this in mind though for the future.... 
> 
> I think I know why it whacks the timeouts though - it was configured like this: 
>     <timeStampingBrokerPlugin zeroExpirationOverride="1000" ttlCeiling="60000" futureOnly="true"/>
> !! 
> 
> I should have picked this up sooner really but had a blind spot as I thought I had only added some plugins for logging/traceability purposes. 
> 
> Cheers - and thanks again, 
> 
> John 
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://activemq.2283324.n4.nabble.com/Persistent-messages-moving-to-DLQ-when-consumer-not-active-tp4676652p4676768.html
> To unsubscribe from Persistent messages moving to DLQ when consumer not active, click here.
> NAML




--
View this message in context: http://activemq.2283324.n4.nabble.com/Persistent-messages-moving-to-DLQ-when-consumer-not-active-tp4676652p4676798.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Persistent messages moving to DLQ when consumer not active

Posted by johnd <jl...@gmail.com>.
artnaseef wrote
> Cool - you're welcome.
> 
> Note that plugin may be valuable if your broker clocks ever get far
> out-of-sync, so you might want to look more closely at why the plugin was
> whacking the timeouts.  Note that I'm saying this with only a brief look
> at that code, so I can't say for sure right now that it can work the way
> you need.

Both brokers on the same machine (at the moment!) so not an issue. I'll bare
this in mind though for the future.... 

I think I know why it whacks the timeouts though - it was configured like
this:
    <timeStampingBrokerPlugin zeroExpirationOverride="1000"
ttlCeiling="60000" futureOnly="true"/>
!!

I should have picked this up sooner really but had a blind spot as I thought
I had only added some plugins for logging/traceability purposes. 

Cheers - and thanks again,

John




--
View this message in context: http://activemq.2283324.n4.nabble.com/Persistent-messages-moving-to-DLQ-when-consumer-not-active-tp4676652p4676768.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Persistent messages moving to DLQ when consumer not active

Posted by artnaseef <ar...@artnaseef.com>.
Cool - you're welcome.

Note that plugin may be valuable if your broker clocks ever get far
out-of-sync, so you might want to look more closely at why the plugin was
whacking the timeouts.  Note that I'm saying this with only a brief look at
that code, so I can't say for sure right now that it can work the way you
need.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Persistent-messages-moving-to-DLQ-when-consumer-not-active-tp4676652p4676767.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Persistent messages moving to DLQ when consumer not active

Posted by johnd <jl...@gmail.com>.
Yes it was! I must have added this by mistake when adding the logging plugins
(from a cut and past!). Removing this solved the problem. Thank you very
much for this!

Regards,

John




--
View this message in context: http://activemq.2283324.n4.nabble.com/Persistent-messages-moving-to-DLQ-when-consumer-not-active-tp4676652p4676761.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Persistent messages moving to DLQ when consumer not active

Posted by artnaseef <ar...@artnaseef.com>.
Is the stand-alone broker using the TimeStampingBrokerPlugin?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Persistent-messages-moving-to-DLQ-when-consumer-not-active-tp4676652p4676718.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Persistent messages moving to DLQ when consumer not active

Posted by johnd <jl...@gmail.com>.
I have also tried replacing the 'preserveMessageQos=true' config option (on
the camel routes/subscriptions) with 'disableTimeToLive=true' option,ie


This seems to have no effect on the message expiration either - it is still
being set. The only messages I can see with an expiration of 0 are those in
the DLQs.











--
View this message in context: http://activemq.2283324.n4.nabble.com/Persistent-messages-moving-to-DLQ-when-consumer-not-active-tp4676652p4676705.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Persistent messages moving to DLQ when consumer not active

Posted by johnd <jl...@gmail.com>.
Some further info....

If I stop the standalone activemq broker/instance and look at the message in
the queue on the side of the embedded broker, I can see the message has the
correct expiration set:


When I start the standalone broker, this message gets routed to the topic
with the following camel route


but appears to lose the message expiration time:


So it looks like the TTL/expiration time is not being preserved across this
route. Does anyone have any ideas as to why this is the case?

Note that I have verified that the message ttl/expiration is preserved when
the message is moved across the static bridge (i.e. the ttl/expiration is
also correct when I look at the message in the App.EventQueue on the
standalone broker side of the bridge).

Thanks,

John




--
View this message in context: http://activemq.2283324.n4.nabble.com/Persistent-messages-moving-to-DLQ-when-consumer-not-active-tp4676652p4676702.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.