Is there a way to create a blocking data reader using the python based Connector? Or is the accepted practice for readers to call input.read() or input.take() (or samples.get_length() looking for non-zero) in a loop with some kind of delay between calls?
The Connector class currently provides a wait() function that waits until at least one input has data.
Thanks Alejandro.
I tried it and it generated an error saying missing arguments. Is there documentation on the Connector API?
It expects an integer argument that indicates the maximum wait, in milliseconds.
We're working on a release that will bring Connector to product-level quality, including documentation. Until that release later this year, Connector is experimental and only provides the documentation in the README.md.
I tried wait(100000) with my publisher not publishing any data and I see my subscriber block for only a second or so. I only have the 2 domain participants running.
I'm running Connext 5.3.1 on RHEL 7.4.
Can you print the result of wait()? A zero indicates that there is data available, a 10 indicates a timeout. (By the way, this method will change in the upcoming release.)
It's returning a 10 without any my topic being published, after being called like wait(100000). I haven't explicitly timed it in my program but it's returning very quickly, less than a couple of seconds. If I use a larger timeout value I see the same behavior.
I've verified that there was a bug in the version you're running that prevents the wait function from waiting more than 1 second. The currently available version (Connext 6.0-based) behaves correctly.