本文介绍了RabbitMQ 3.1.3和缺少的时间戳头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以配置代理以在消息中缺少时间戳头时插入它?因此,如果发布客户端未添加时间戳标头,则代理是否可以将其插入与交易所收到消息的那一刻匹配的时间戳值?我应该在哪里寻找该配置?还是一个坏主意?

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?

推荐答案

要回答您的问题,没有办法配置代理插入时间戳。 AMQP规范中的任何内容都不需要消息知道消息何时到达代理,并且请记住,在代理端手动插入时间戳仅表示代理何时接收消息,而不是消息何时发布。

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.

如果您热衷于此,您可以编写自己的RabbitMQ插件来执行此操作,但我不建议您这样做。相反,我建议您强制生产者在其消息属性中包含时间戳。

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.

资源:

这篇关于RabbitMQ 3.1.3和缺少的时间戳头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 02:16
查看更多