How do I get a timestamp for when a message was received by RabbitMQ? In our application, we would like to measure how long a message was in the queue:
time_in_queue=System.currentTimeMillis() - timestamp_from_msg
How do I get a timestamp for when a message was received by RabbitMQ? In our application, we would like to measure how long a message was in the queue:
time_in_queue=System.currentTimeMillis() - timestamp_from_msg
At least as of RMQ 5.10.0, it appears that there is a getTimestamp() method on the properties object returned with each message.
public class ExchangeConsumer extends DefaultConsumer {
...
@Override
public void handleDelivery(String consumerTag,
Envelope envelope,
AMQP.BasicProperties properties,
byte[] body) throws IOException {
Date timestamp = properties.getTimestamp();
}