简体   繁体   English

作为 ActiveMQ 订阅者,我如何获取消息发布者用户名或任何其他标识符以供以后使用?

[英]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.

相关问题 我可以让我的JMS主题在新订阅者连接时通知发布者(使用ActiveMQ) - Can I have my JMS topic notify the publisher when a new subscriber connects (using ActiveMQ) ACTIVEMQ - 订阅者如何在发布者之后启动时收到主题消息? - ACTIVEMQ - How can subscriber receive topic messages when started after publisher? ACTIVEMQ-发布者订阅者hello world示例 - ACTIVEMQ- publisher subscriber hello world example 谁能告诉我如何在C#中为活动的MQ主题消息创建持久的发布者和订阅者? - Can anyone tell me how to create a durable publisher and subscriber for active mq topic message in c#? ActiveMQ Jolokia API如何获取完整的Message Body - ActiveMQ Jolokia API How can I get the full Message Body ActiveMQ:我可以让Queue成为Topic的订阅者吗? - ActiveMQ: Can i make Queue as a subscriber to Topic? 如何使用 JMS Publisher 和 JMS Subscriber 为 JMeter 中的订阅者过滤来自 ActiveMQ 的响应消息 - How to filter response messages from ActiveMQ for subscribers in JMeter using JMS Publisher and JMS Subscriber 使用STOMP在ActiveMQ中为指定订户锁定消息多长时间? - How long is message locked for specified subscriber in ActiveMQ using STOMP? 如何从“ org.apache.activemq.command.Message”获取actievmq队列的大小? - How can I get actievmq queue's size from the “org.apache.activemq.command.Message”? MCollective如何从ActiveMQ队列中替换失效的订户? - How can MCollective replace a dead subscriber from an ActiveMQ queue?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM