activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MrBunt1 <>
Subject ActiveMQ 5.2 messages with Time to Live sent straight to DLQ
Date Tue, 13 Oct 2009 15:04:10 GMT

ActiveMQ 5.2 messages with Time to Live sent straight to DLQ

I am experiencing difficulties with the messaging infrastructure I am
developing.  I have a situation where message expiration does not work
correctly on one broker for the request/response messaging pattern.

I am using ActiveMQ 5.2.0 (stable release) and writing code in C# (.net 2.0)
using 1.3.0 RC1.

I have three brokers, which is the begining of a hub/spoke network of

Hub: Windows 2003 Server R2 SP2, Java 1.6.0_7

Spoke A: Windows XP SP3, Java 1.6.0_7

Spoke B: Windows 2003 Server R2 SP2, Java 1.6.0_7

The spokes have the same network connector setting in the ActiveMq.xml file:
<networkConnector name="NHSBT.BASE.NDCVB111"
uri="static://(tcp://ndcvb111:61616)" networkTTL="7"  duplex="true"

All the PC clocks are synchronised.

I have a consumer console application on the spokes and a sender application
on the hub.  All messages set with an expiry of 10 secods are sent to the
localhost broker and I let ActiveMQ manage the forwarding of messages to the
correct destination broker.
When I send a message to a queue from the Sender application on the Hub
broker to Broker A, I receive the expected responses from the consumer. And
when the consumer running on Broker A is shutdown, any messages waiting in
the queue on Broker A expire as expected.

Although when I send messages from Sender application on the Hub Broker (on
a different queue) to Broker B, the message goes straight into the DLQ on
Broker B.  This is not what I expected or want.  

I have trawled relevant message boards and seen some old posts mentioning
some issues surrounding the Time To Live property in terms of converting
between java and .net date types and whether relative or absolute times are
being used.  
To this affect I have tried changing the Time To Live to a large number e.g.
40000000000 and my messages get through to the queue on Broker B, but
consequently they do not expire when the consumer is offline.  This is not a
workaround that I want to use.

I am wondering whether anyone has any suggestions of things that I could
check such as configuration settings.  Or has anyone experienced a similar
problem and knows of a fix?

Here is a snippet from my C# code when sending the message, the connection
and the session (using AutoAcknowledge) are already both established.

IObjectMessage objectMessage = session.CreateObjectMessage( new Point( x, y
) );
objectMessage.NMSReplyTo = temporaryQueue;
string correlationId = Guid.NewGuid().ToString();
objectMessage.NMSCorrelationID = correlationId;

NmsDestinationAccessor destinationResolver = new NmsDestinationAccessor();
IDestination destination = destinationResolver.ResolveDestinationName(
session, queue );

using ( IMessageProducer producer = session.CreateProducer() )
	producer.Send( destination, objectMessage, MsgDeliveryMode.Persistent,
MsgPriority.Normal, TimeSpan.FromMilliseconds( 10000 ));

	IMessage responseMessage = messageConsumer.Receive( TimeSpan.FromSeconds(
20 ) );

	ITextMessage textMessage = responseMessage as ITextMessage;
        if ( textMessage != null )
		Console.WriteLine( textMessage.Text );	
        	Console.WriteLine( "Timeout waiting for reply" );

Many thanks in advance for any pointers on this one.

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message