异常信息:
1. 启动的时候,控制台会打印出close, 这是outbond通道的类打印出来的
2. 我模拟product发送一条数据,tomcat控制台输出异常信息
ERROR inbound.MqttPahoMessageDrivenChannelAdapter - Lost connection:宸叉柇寮?繛鎺? retrying...
ERROR inbound.MqttPahoMessageDrivenChannelAdapter - Lost connection:宸叉柇寮?繛鎺? retrying...
接收到信息ooo:close
我的配置如下:
mqtt.xml
<bean id="clientFactory"
class="org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory">
<property name="userName" value="admin" />
<property name="password" value="password" />
</bean>
<!-- 消息适配器 -->
<int-mqtt:message-driven-channel-adapter
id="mqttInbound"
client-id="CID_2016524123456"
url="tcp://localhost:61613"
topics="iot"
qos="1"
client-factory="clientFactory"
auto-startup="true"
send-timeout="12"
channel="output" />
<int:service-activator input-channel="output" method="handleMessage" ref="mqttLogger" />
<bean id="mqttLogger" class="com.iot.device.mqtt.MqttReciever" />
<int:service-activator input-channel="errorChannel" ref="errorMessageLogger" method="logError" />
<bean id="errorMessageLogger" class="com.iot.device.mqtt.ErrorMessageLogger" />
我用的win7 64位系统,选择 org.eclipse.paho.ui.app-1.0.2-win32.win32.x86_64.zip 下载。 试试这个测试工具,还有就是mqtt服务器有很多 没人知道你用的是什么
你是否开启了相应的账号密码插件 这个密码不是服务器的登录密码 总之你先用这个工具测试一下 你就明白这些参数的意思了
这个是发送端和接收端id重复导致的