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.
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.