Friday 4 March 2016

[ActiveMQ] Message Expiration(Time to Live) Confusion

I set message expiration time as 10000(milliseconds). and put message into 'TEST.QUEUE ' queue. It expected that the enqueue count is going up and expired after 10 seconds. Unexpectedly, but not only enqueue count is not going up but also an exception is not occur. This phenomenon can occur when ESB(ActiveMQ) Server system time is different with client system time.




JMSTimestamp is set by client. And JMSExpiration is set as JMSTimestamp + time to live time. But, ActiveMQ expire message based on server system time. For example, if Client system time is '2016-03-04 11:00:00' and server system time is '2016-03-04 11:00:00' and time to live of message is 1 minute, the message is expired after 30 seconds.


Therefore, if ActiveMQ server system time is faster than client system time and a time to live of message is smaller than difference between server system time and client system time, the message is expired before entering a queue.

No comments:

Post a Comment