Subscriber is a protobuf-aware subscriber and uses ZmqSubscriber for the lower level protocol.
More...
|
def | __init__ (self, *handler, list topic_types, zmq.asyncio.Context zmq_ctx, unknown_handler=None, asyncio.AbstractEventLoop loop=None) |
|
def | start (self) |
| Start reading from socket. More...
|
|
def | stop (self) |
| Stop reading from socket. More...
|
|
def | connect (self, str endpoint) |
| Connect to endpoint. More...
|
|
def | disconnect (self, str endpoint) |
| Disconnect from endpoint. More...
|
|
def | subscribe (self, topic_name) |
| Subscribe on the topic topic_name . More...
|
|
def | unsubscribe (self, topic_name) |
| Unsubscribe to topic identified by topic_name . More...
|
|
|
| is_closed = property |
| Returns true if subscriber is not running, false otherwise. More...
|
|
Subscriber is a protobuf-aware subscriber and uses ZmqSubscriber for the lower level protocol.
◆ __init__()
def rad.services.pubsub.Subscriber.__init__ |
( |
|
self, |
|
|
* |
handler, |
|
|
list |
topic_types, |
|
|
zmq.asyncio.Context |
zmq_ctx, |
|
|
|
unknown_handler = None , |
|
|
asyncio.AbstractEventLoop |
loop = None |
|
) |
| |
- Params
- handler Callable that will be called with the received topics. Should take two arguments, topic-name and the parsed topic type. Example my_handler(topic_name, topic_type) topic_types list of protobuf message types that form the known set of topic types that can be decoded. [<pb_msg>, <pb_msg>, ...] zmq_ctx ZMQ context. unknown_handler Handler of unknown topics (optional). loop Event loop or None to use the default.
◆ connect()
def rad.services.pubsub.Subscriber.connect |
( |
|
self, |
|
|
str |
endpoint |
|
) |
| |
◆ disconnect()
def rad.services.pubsub.Subscriber.disconnect |
( |
|
self, |
|
|
str |
endpoint |
|
) |
| |
Disconnect from endpoint.
◆ start()
def rad.services.pubsub.Subscriber.start |
( |
|
self | ) |
|
Start reading from socket.
@todo: Return future instead?
- Returns
- Coroutine. The ZMQ socket reader coro that needs to be awaited on.
◆ stop()
def rad.services.pubsub.Subscriber.stop |
( |
|
self | ) |
|
Stop reading from socket.
@todo: Return future instead?
- Returns
- Coroutine. The ZMQ socket reader coro that needs to be awaited on.
◆ subscribe()
def rad.services.pubsub.Subscriber.subscribe |
( |
|
self, |
|
|
|
topic_name |
|
) |
| |
Subscribe on the topic topic_name
.
- Note
- ZMQ topic filtering is done simply on the start of the string, subscribing to 'foo' will match the published topic 'foobar'.
- Params
- topic_name Topic name (str or bytes).
◆ unsubscribe()
def rad.services.pubsub.Subscriber.unsubscribe |
( |
|
self, |
|
|
|
topic_name |
|
) |
| |
Unsubscribe to topic identified by topic_name
.
◆ is_closed
rad.services.pubsub.Subscriber.is_closed = property |
|
static |
Returns true if subscriber is not running, false otherwise.
The documentation for this class was generated from the following file: