我試圖通過Spring MQTT客戶端閱讀訂閱的主題消息。Spring MQTT訂閱者配置
<mqtt:message-driven-channel-adapter id="mqttInbound"
client-id="mySpringServer"
url="tcp://localhost:1883"
topics="foo2015"
auto-startup="true"
client-factory="clientFactory"
channel="fileChannel"/>
比具有 「fileChannel
」 信道相反,我喜歡通過Spring MQTT客戶端來處理它們。 例如:MqttPahoMessageDrivenChannelAdapter
我可以使用MqttPahoMessageDrivenChannelAdapter
作爲一個bean,並參照 「mqttInbound
」?
所有傳入「mqttInbound
」的消息都會重定向到MqttPahoMessageDrivenChannelAdapter
。我可以這樣做嗎?
更新: 我可以將傳入消息重定向到bean嗎?有沒有我可以使用的界面?
例如:
<mqtt:message-driven-channel-adapter ... channel="msgChannel" />
<bean id="msgChannel" class="org.channel.AnyMessageReader"/>
我看到下面的例子,但我不知道究竟這就是我要找的。
<int:channel id="channel_01" />
<int:service-activator id="serviceActivator" input-channel="channel_01" ref="msgService" method="setMessage" />
<bean id="msgService" class="org.channel.AnyMessageService"/>
我剛剛更新了這個問題。我想我在這裏不知道。我檢查了春季文檔,但沒有結果。我想我應該首先了解一下Spring-JMS的一些背景知識。 – user2172625