Singleton MQTT service Why duplicate message is received

At first, I wrote MQTT and is not only case model, use the application, run out of the destruction.

 

Later, once you need to transfer 300 news devices, cpu direct 100%, and then changed to a single-case model, the way a plug here, the other authentication device ID with the username, then the other side is always only received the first device data (I did not find was the first), then this problem intermittently around almost a week (mainly we have things on hand, may not have empty).

 

So here it is actually recorded two questions, the first is the Singleton pattern MQTT message is lost, only a small part of the reception was successful, is likely to be a result of the authentication.

 

The second MQTT Why am I getting duplicate data, because accustomed to the previous wording, while singletons, each writing a release, on the way to write a reception there, forget the events will be superimposed, then receive data after, there are several places tied to receive event data is repeated several times.

 

Correct posture is initialized when a statement is received, then no matter, where needed release published directly, without receiving tube

 

Forgive me log more and more rough, it is not empty

Guess you like

Origin www.cnblogs.com/bamboo-zhang/p/12177404.html