[英]As an ActiveMQ subscriber how can I get the message publisher username or any other identifier to be used later?
As an ActiveMQ subscriber I want to know the user name of the message publisher or any identifier on receiving the message.作为 ActiveMQ 订阅者,我想知道消息发布者的用户名或接收消息时的任何标识符。 I'm using the MQTT protocol and the flow of message received from ActiveMQ broker will be saved according to provided identifier.
我正在使用 MQTT 协议,从 ActiveMQ 代理接收到的消息流将根据提供的标识符进行保存。
I have another constraints.我还有另一个限制。 The authorized publisher will just publish only the data on specified topic and will not provide any extra identifier value with the data.
授权发布者将仅发布指定主题的数据,并且不会为数据提供任何额外的标识符值。
Typically in this kind of situation you'd set populateJMSXUserID="true"
in your activemq.xml
and then when you receive the message you could just look at the JMSXUserID
property.通常在这种情况下,您会在
activemq.xml
设置populateJMSXUserID="true"
,然后当您收到消息时,您只需查看JMSXUserID
属性即可。 However, since MQTT doesn't support message properties this almost certainly won't work for you.但是,由于 MQTT 不支持消息属性,这几乎肯定不适合您。
I think you'd probably have to write your own broker plugin to modify the body of the MQTT message with the necessary identifier.我认为您可能必须编写自己的代理插件才能使用必要的标识符修改 MQTT 消息的正文。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.