randomsync / robotframework-mqttlibrary

MQTT Keyword Library for Robot Framework
Apache License 2.0
25 stars 30 forks source link

Added background (thread) looping functionality #9

Closed janvanoverwalle closed 5 years ago

janvanoverwalle commented 5 years ago

Added support for subscribing and listening to topics into 2 separate function calls using a background loop thread.

Instead of being able to only subscribe and listen using 1 call, it is now possible to subscribe and later on use multiple listens to poll for messages. This enables subscribing at the start of a test, trigger a publish and afterwards listen to the topic. At the end of the test, an unsubscribe is recommended when using this method to stop the background thread (also happens on disconnect).

The original subscribe (+ listen) functionality is still present and works in exactly the same way. To use the new method (separate subscribe and listen), set the timeout in the subscribe call to 0 (default).

This is also a solution to issue #6

janvanoverwalle commented 5 years ago

Closed and reopened due to test incompatibility and pending investigation of implementation necessity

maartenl945 commented 5 years ago

Excellent, this works fine. Can this pull request please be merged ?