Spring MqttPahoMessageDrivenChannelAdapter Lost connection:Connection lost; retrying

前端 未结 2 1891
庸人自扰
庸人自扰 2021-01-14 20:06

We are using Spring message-driven-channel-adapter to subscribe MQTT topic. But we are getting below error very frequently. I have tes

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-14 20:43

    But you are still not really describing a problem. You show a message above so it must be working for you. Paho is detecting a connection problem; it informs Spring Integration which will reconnect.

    You can get complete information about the exception by adding an ApplicationListener to your application.

    @Bean
    public ApplicationListener eventListener() {
        return new ApplicationListener() {
    
            @Override
            public void onApplicationEvent(MqttConnectionFailedEvent event) {
                event.getCause().printStackTrace();
            }
    
        };
    }
    

    Result:

    Connection lost (32109) - java.io.EOFException
        at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:164)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: java.io.EOFException
        at java.io.DataInputStream.readByte(DataInputStream.java:267)
        at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:92)
        at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:116)
        ... 1 more
    

    (when I shut down the broker).

    If you think there's a problem with the paho client, you should raise an issue for that project.

提交回复
热议问题