You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by swapnonil <sw...@gmail.com> on 2011/03/28 12:54:57 UTC
Cannot browse or consume messages (with ttl setting) from a Queue.
Hello Everybody,
I am creating and sending messages from the "Send" tab in Active MQ Web
Console. I am setting the following parameters
1. Queue Name : BackupQueue
2. Persistent Delivery : true
3. Time to live : 300000 (5 minutes)
4. Message Body: "A message in a bottle"
But when I try to consume the message using the following code, the consumer
does not get invoked.
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory(backUpServerUrl);
try
{
Connection connection = connectionFactory.createConnection();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer=
session.createConsumer(session.createQueue("BackupQueue"));
consumer.setMessageListener(new MessageListener()
{
public void onMessage(Message message)
{
System.out.println("message = " + message);
}
});
connection.start();
}
catch (JMSException e)
{
LOGGER.log(Level.SEVERE, "", e);
}
The consumer does not get invoked even after 5 minutes (i.e after the
message has expired). It goes straight into the DLQ.
But then if I remove the Time to live parameter from the message, my
consumer gets invoked immediately.
Can't I consume messages for which there is a preset time to live set?
Thanks and With Regards.
Swapnonil Mukherjee
--
View this message in context: http://activemq.2283324.n4.nabble.com/Cannot-browse-or-consume-messages-with-ttl-setting-from-a-Queue-tp3411305p3411305.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Cannot browse or consume messages (with ttl setting) from a Queue.
Posted by "Martin C." <ma...@gmx.at>.
> 3. Time to live : 300000 (5 minutes)
I'm not sure and I haven't checked the source-code, but could it be
that the field is actually setting the timestamp when the message is
going to expire instead of the TTL?
Best regards,
Martin
Re: Cannot browse or consume messages (with ttl setting) from a
Queue.
Posted by Swapnonil Mukherjee <sw...@gmail.com>.
Figured out what the problem was. The producer sending messages had it's
clock ahead by ten minutes compared to the VM where the broker was running.
As soon as I set the expiry to more than 15 minutes the problem was solved.
--
View this message in context: http://activemq.2283324.n4.nabble.com/Cannot-browse-or-consume-messages-with-ttl-setting-from-a-Queue-tp3411305p3442992.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.