Вопрос

Is it possible to configure the broker to insert a timestamp header if it is missing in the message? So if the publishing client does not add the timestamp header, can the broker insert it with a timestamp value matching the moment the message was received by the exchange? Where should I look for that configuration? Or is that a bad idea?

Это было полезно?

Решение 2

So to answer your question, no there is no way to configure the broker to insert a timestamp. Nothing the in AMQP specification requires a message to know when it arrives at the broker and keep in mind that manually inserting the timestamp on the broker side will only represent when the message was received by the broker, not when it was published.

If you are hell-bent on doing this you could write your own RabbitMQ plugin to do this but I would not recommend doing this. Instead I would recommend forcing your producers to include the timestamp in their message properties.

Resources:

RabbitMQ Message Arrival Timestamp

RabbitMQ AMQP.BasicProperties Java API

Другие советы

As of 2015, there are new answers for the original question.

This plugin will do exactly what you were looking for.

Take in mind there will be some minimal overhead since it will hook all messages being queued.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top