Zenoh bridging¶
dataClay includes support for publisher/subscriber communication via Zenoh.
In order to use this functionality, the client class has to inherit the ZenohMixin class. Communications can
be established using pub/sub and queries.
The subscriber can specify how the messages will be handled and to which topics it will be subscribed. Also, it can ask for the last value stored in an existing subscription using the queries.
The publisher can send messages to a specific topic.
- class ZenohMixin(conf: str = '{}')[source]¶
Zenoh mechanisms
- handler(sample)[source]¶
Placeholder for function handler. This function describes how the client will handle a message.
- Parameters:
sample (zenoh.Sample) – Information sent by Zenoh to the subscriber.
- Raises:
NotImplementedError – If the handler function has not been implemented an error is raised.
- produce_zenoh_msg(buf: str = '', key: str = 'dataclay', **more)[source]¶
Sends the message “buf” to the topic “key”.
- Parameters:
buf (str, optional) – Message. Defaults to “”.
key (str, optional) – Topic. Defaults to “dataclay”.
- send_to_zenoh()[source]¶
Previous function to produce_zenoh_msg. Gets all the arguments needed from the calling class.
- receive_data(key: str = 'dataclay')[source]¶
Create a thread which will check if a message from the topic arrives and will handle it.
- Parameters:
key (str) – Topic.