mirror of https://github.com/apache/activemq.git
set new expiration time
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@639499 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f4971bf2dc
commit
47183aeeaa
|
@ -39,7 +39,15 @@ public class TimeStampingBrokerPlugin extends BrokerPluginSupport {
|
||||||
if (message.getTimestamp() > 0
|
if (message.getTimestamp() > 0
|
||||||
&& (message.getBrokerPath() == null || message.getBrokerPath().length == 0)) {
|
&& (message.getBrokerPath() == null || message.getBrokerPath().length == 0)) {
|
||||||
// timestamp not been disabled and has not passed through a network
|
// timestamp not been disabled and has not passed through a network
|
||||||
message.setTimestamp(System.currentTimeMillis());
|
long oldExpiration = message.getExpiration();
|
||||||
|
long newTimeStamp = System.currentTimeMillis();
|
||||||
|
if (oldExpiration > 0) {
|
||||||
|
long oldTimestamp = message.getTimestamp();
|
||||||
|
long timeToLive = oldExpiration-oldTimestamp;
|
||||||
|
long expiration = timeToLive+newTimeStamp;
|
||||||
|
message.setExpiration(expiration);
|
||||||
|
}
|
||||||
|
message.setTimestamp(newTimeStamp);
|
||||||
}
|
}
|
||||||
super.send(producerExchange, message);
|
super.send(producerExchange, message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue