eclipse-paho / paho.mqtt.cpp

Other
1.03k stars 438 forks source link

Add function for checking async consumer event queue size #518

Open ssams opened 3 weeks ago

ssams commented 3 weeks ago

This adds a function consumer_events_available() on the async client to get the number of events available for consumption. Similar to e558946c1dd664214505b48ca769024c781a53a6 I've added a default impl to the interface to avoid breaking old code which inherits from it.

The idea behind this is to allow exposing some stats in metrics, i.e. to see when consumers are lagging behind in consuming/processing messages, and the "pending" event count goes up. It may be also useful in some scenarios when implementing polling consumers, although I expect that in most cases the existing try_consume... functions are still more appropriate there.

fpagliughi commented 3 weeks ago

Good idea. One minor nit.

ssams commented 3 weeks ago

One minor nit.

If you're referring to the failed check, that seems to be some (temporary?) error in the Mosquitto installation before the actual build - I don't think I can rerun the check myself though? At least I couldn't find one so far...