RabbitMQ 3.1.3 and the missing timestamp header

雨燕双飞 提交于 2019-12-10 17:39:54

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/18002472/rabbitmq-3-1-3-and-the-missing-timestamp-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!