EventConsumer
hololinked.core.zmq.brokers.BaseEventConsumer
Bases: BaseZMQClient
Consumes events published at PUB sockets using SUB socket
Source code in hololinked/hololinked/core/zmq/brokers.py
2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 | |
Functions
__init__
__init__(id: str, event_unique_identifier: str, access_point: str, context: Context | None = None, **kwargs) -> None
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
unique identity for the consumer |
required |
|
str
|
unique identifier of the event registered at the PUB socket |
required |
|
str
|
socket address of the event publisher ( |
required |
|
Context | None
|
ZMQ context to use, if None, a global context is used. |
None
|
|
additional arguments:
|
{}
|
Source code in hololinked/hololinked/core/zmq/brokers.py
2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 | |
subscribe
subscribe to the event at the PUB socket
Source code in hololinked/hololinked/core/zmq/brokers.py
stop_polling
interrupt_message
craft an interrupt message to be sent to the interruptor socket, if stop_polling() is not sufficient as
the poll timeout is infinite. Used internally by interrupt() method.
Source code in hololinked/hololinked/core/zmq/brokers.py
hololinked.core.zmq.brokers.EventConsumer
Bases: BaseEventConsumer, BaseSyncZMQ
Sync Event Consumer to used outside of async loops
Source code in hololinked/hololinked/core/zmq/brokers.py
Functions
receive
receive(timeout: float | None = 1000, raise_interrupt_as_exception: bool = False) -> EventMessage | None
receive event with given timeout
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float | None
|
timeout in milliseconds, None for blocking |
1000
|
|
bool
|
if True, raises BreakLoop exception when interrupted, otherwise returns None |
False
|
Source code in hololinked/hololinked/core/zmq/brokers.py
interrupt
interrupts the event consumer. Generally should be used for exiting this object if there is no poll period/infinite polling. Otherwise please use stop_polling().
Source code in hololinked/hololinked/core/zmq/brokers.py
hololinked.core.zmq.brokers.AsyncEventConsumer
Bases: BaseEventConsumer, BaseAsyncZMQ
Async Event Consumer to be used inside async loops
Source code in hololinked/hololinked/core/zmq/brokers.py
2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 | |
Functions
receive
async
receive(timeout: float | None = 1000, raise_interrupt_as_exception: bool = False) -> EventMessage | None
receive event with given timeout
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float | None
|
timeout in milliseconds, None for blocking |
1000
|
|
bool
|
if True, raises BreakLoop exception when interrupted, otherwise returns None |
False
|
Source code in hololinked/hololinked/core/zmq/brokers.py
interrupt
async
interrupts the event consumer. Generally should be used for exiting this object if there is no poll period/infinite polling. Otherwise please use stop_polling().