I'm wondering how to use stomp.py client in a pick-process-finish manner. This means: start; connect; check the queue; pick messages; process them; disconnect; finish.
The lib seems to be designed for indefinitely running clients which listen on arriving messages and process them. The main thread has to somehow remain running/connected while the listener thread processes the incoming messages.
It strikes me the examples are happily using time.sleep(X)
to keep the main thread up and running. This is not really viable since there is no guarantee the listener thread finishes its work before the sleep ends. With a static sleep you can't guarantee you can process all messages before you disconnect, right? ACKs are fine and usable but still.
Is there a way to keep the main thread up until the listener finishes its work?