@Override public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception { if (message.getTimestamp() > 0 && !isDestinationDLQ(message) && (processNetworkMessages || (message.getBrokerPath() == null || message.getBrokerPath().length == 0))) { // timestamp not been disabled and has not passed through a network or processNetworkMessages=true long oldExpiration = message.getExpiration(); long newTimeStamp = System.currentTimeMillis(); long timeToLive = zeroExpirationOverride; long oldTimestamp = message.getTimestamp(); if (oldExpiration > 0) { timeToLive = oldExpiration - oldTimestamp; } if (timeToLive > 0 && ttlCeiling > 0 && timeToLive > ttlCeiling) { timeToLive = ttlCeiling; } long expiration = timeToLive + newTimeStamp; // In the scenario that the Broker is behind the clients we never want to set the // Timestamp and Expiration in the past if(!futureOnly || (expiration > oldExpiration)) { if (timeToLive > 0 && expiration > 0) { message.setExpiration(expiration); } message.setTimestamp(newTimeStamp); LOG.debug("Set message {} timestamp from {} to {}", new Object[]{ message.getMessageId(), oldTimestamp, newTimeStamp }); } } super.send(producerExchange, message); }
@Override public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception { if (message.getTimestamp() > 0 && !isDestinationDLQ(message) && (processNetworkMessages || (message.getBrokerPath() == null || message.getBrokerPath().length == 0))) { // timestamp not been disabled and has not passed through a network or processNetworkMessages=true long oldExpiration = message.getExpiration(); long newTimeStamp = System.currentTimeMillis(); long timeToLive = zeroExpirationOverride; long oldTimestamp = message.getTimestamp(); if (oldExpiration > 0) { timeToLive = oldExpiration - oldTimestamp; } if (timeToLive > 0 && ttlCeiling > 0 && timeToLive > ttlCeiling) { timeToLive = ttlCeiling; } long expiration = timeToLive + newTimeStamp; // In the scenario that the Broker is behind the clients we never want to set the // Timestamp and Expiration in the past if(!futureOnly || (expiration > oldExpiration)) { if (timeToLive > 0 && expiration > 0) { message.setExpiration(expiration); } message.setTimestamp(newTimeStamp); LOG.debug("Set message {} timestamp from {} to {}", new Object[]{ message.getMessageId(), oldTimestamp, newTimeStamp }); } } super.send(producerExchange, message); }
@Override public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception { if (message.getTimestamp() > 0 && !isDestinationDLQ(message) && (processNetworkMessages || (message.getBrokerPath() == null || message.getBrokerPath().length == 0))) { // timestamp not been disabled and has not passed through a network or processNetworkMessages=true long oldExpiration = message.getExpiration(); long newTimeStamp = System.currentTimeMillis(); long timeToLive = zeroExpirationOverride; long oldTimestamp = message.getTimestamp(); if (oldExpiration > 0) { timeToLive = oldExpiration - oldTimestamp; } if (timeToLive > 0 && ttlCeiling > 0 && timeToLive > ttlCeiling) { timeToLive = ttlCeiling; } long expiration = timeToLive + newTimeStamp; // In the scenario that the Broker is behind the clients we never want to set the // Timestamp and Expiration in the past if(!futureOnly || (expiration > oldExpiration)) { if (timeToLive > 0 && expiration > 0) { message.setExpiration(expiration); } message.setTimestamp(newTimeStamp); LOG.debug("Set message {} timestamp from {} to {}", new Object[]{ message.getMessageId(), oldTimestamp, newTimeStamp }); } } super.send(producerExchange, message); }
@Override public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception { if (message.getTimestamp() > 0 && !isDestinationDLQ(message) && (processNetworkMessages || (message.getBrokerPath() == null || message.getBrokerPath().length == 0))) { // timestamp not been disabled and has not passed through a network or processNetworkMessages=true long oldExpiration = message.getExpiration(); long newTimeStamp = System.currentTimeMillis(); long timeToLive = zeroExpirationOverride; long oldTimestamp = message.getTimestamp(); if (oldExpiration > 0) { timeToLive = oldExpiration - oldTimestamp; } if (timeToLive > 0 && ttlCeiling > 0 && timeToLive > ttlCeiling) { timeToLive = ttlCeiling; } long expiration = timeToLive + newTimeStamp; // In the scenario that the Broker is behind the clients we never want to set the // Timestamp and Expiration in the past if(!futureOnly || (expiration > oldExpiration)) { if (timeToLive > 0 && expiration > 0) { message.setExpiration(expiration); } message.setTimestamp(newTimeStamp); LOG.debug("Set message {} timestamp from {} to {}", new Object[]{ message.getMessageId(), oldTimestamp, newTimeStamp }); } } super.send(producerExchange, message); }