环境
- EMQX 版本:5.0.26
- 操作系统版本:centos7
具体的问题
使用java集成客户端,我们的业务是订阅某个主题,收到消息后处理完发送到具体的另外一个主题上作为返回消息
我的实现方式是先创建一个客户端一直订阅消息,然后处理完消息后再创建一个客户端发送回去后关闭发送的客户端.但是再晚上收到主题消息后处理完业务发送返回消息的客户端报错了,具体的错误日志如下.client_id 是有一个固定前缀,加上后面6位随机数
预期行为
实际行为
Not authorized to connect (5)
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:28)
at org.eclipse.paho.client.mqttv3.internal.ClientState.notifyReceivedAck(ClientState.java:1053)
at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:151)
at java.lang.Thread.run(Thread.java:748)
Client is not connected (32104)
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:31)
at org.eclipse.paho.client.mqttv3.internal.ClientComms.sendNoWait(ClientComms.java:205)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.publish(MqttAsyncClient.java:1375)
at org.eclipse.paho.client.mqttv3.MqttClient.publish(MqttClient.java:570)
at com.grepw.config.MqttSendClient.publish(MqttSendClient.java:34)
at com.grepw.service.impl.AuthStepOneServiceImpl.handle(AuthStepOneServiceImpl.java:67)
at com.grepw.service.impl.AuthStepOneServiceImpl$$FastClassBySpringCGLIB$$5ec9e9e.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)