【发布时间】:2015-10-28 09:51:21
【问题描述】:
我目前正在开发我的第一个 SpringXD Stream。它应该接收关于 MQTT 主题的消息,对服务执行 HTTP POST 并将此结果发布到另一个 MQTT 主题。
目前,我坚持发布到与最初主题不同的 MQTT 主题。
这是我的直播:
stream create test --definition "in:mqtt --url='tcp://hivemq:1883' --topics='+/+/+/my/downlink' --username='test' --password='test' --clientId='client_downlink'
| header-enricher --headers={\"mqtt_topic\":\"headers['mqtt_topic'].replace('/downlink', '/uplink')\"}
| out:mqtt --url='tcp://hivemq:1883' --username='test' --password='test' --clientId='client_uplink'" --deploy
方法是在 Publishing 标头“mqtt_topic”中将“/downlink”替换为“/uplink”,但 header-enricher 不会覆盖现有的标头值,因此发布与我们收到的主题相同消息。
有什么办法可以做到这一点吗?
【问题讨论】:
标签: spring-integration mqtt spring-xd