blocking data reader using the python Connector

8 posts / 0 new
Last post
Offline
Last seen: 4 years 7 months ago
Joined: 12/04/2018
Posts: 4
blocking data reader using the python Connector

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?

Offline
Last seen: 2 months 2 weeks ago
Joined: 04/02/2013
Posts: 194

The Connector class currently provides a wait() function that waits until at least one input has data.

Offline
Last seen: 4 years 7 months ago
Joined: 12/04/2018
Posts: 4

Thanks Alejandro. 

I tried it and it generated an error saying missing arguments. Is there documentation on the Connector API?

 

Offline
Last seen: 2 months 2 weeks ago
Joined: 04/02/2013
Posts: 194

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.

 

Offline
Last seen: 4 years 7 months ago
Joined: 12/04/2018
Posts: 4

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. 

 

Offline
Last seen: 2 months 2 weeks ago
Joined: 04/02/2013
Posts: 194

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

Offline
Last seen: 4 years 7 months ago
Joined: 12/04/2018
Posts: 4

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. 

 

Offline
Last seen: 2 months 2 weeks ago
Joined: 04/02/2013
Posts: 194

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.