shoenig / go-mqtt

A development fork of the Eclipse Paho Go MQTT client
http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt.golang.git/
Eclipse Public License 1.0
13 stars 6 forks source link

Concurrent calls to onPublishReceived results in appearence of out-of-order messages #18

Closed shoenig closed 10 years ago

shoenig commented 10 years ago

With every call to onPub being executed concurrently, it is entirely possible that a stream of incoming messages could appear to arrive out of order (even though they arrive to the client in order). The paho clients seem to just have a single thread executing callbacks, ensuring order.

We could just do that, but another option would be to add another option like SetOrderMatters, which will then execute callbacks serialized like paho, or not, if set to false.

In the serialized case, I'd have 3 goroutines running executing callbacks - one for each qos level, since order is not guaranteed across the spectrum.

shoenig commented 10 years ago

thanks mike 3b1fbe6fe56a37e9af80bc2aaa202b55f44d8c5a