问题
Is there a way how to get a timestamp from time, when 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
回答1:
I updated the "rabbitmq-message-timestamp" plugin. My change was merged and it is possible to use the new header "timestamp_in_ms" which contains timestamp in milliseconds.
回答2:
There's the rabbitmq_message_timestamp plugin that does that:
A plugin that adds a timestamp when a message first enters RabbitMQ.
Author: Team RabbitMQ
Github: rabbitmq/rabbitmq-message-timestamp
来源:https://stackoverflow.com/questions/45182947/timestamp-when-message-was-received-by-rabbitmq