RabbitMQ 3.1.3 and the missing timestamp header

2019-06-28 08:30发布

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条回答
仙女界的扛把子
2楼-- · 2019-06-28 08:59

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.

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-06-28 09:07

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

查看更多
登录 后发表回答