This tool is intended as an example of subscribing to a Nimble data stream.
You can find it under
tools/zmq/subscriber in the release package.
To run the example:
user@host:~$ docker-compose up --build
## Code Breakdown
First, we need to establish a connection to the publisher socket
ctx = zmq.Context()
sub = ctx.socket(zmq.SUB)
With the connection established you can start listening for data, and parsing the topic.
There are currently 3 topics:
data = data_socket.recv_multipart()
topic = data.decode('utf-8')
latency topic are simple reporting streams on overall performance health of the pipeline, the majority of the data is contained within the
Extract out of the channel id and metadata as a python dictionary:
channel_id = int(topic.split("/"))
metadata = json.loads(data.decode('utf-8'))
Parsing the metadata is outside the scope of this document please refer to the metadata schemas.
For a detailed description of the ZMQ publishing protocol please refer to: Data Publishing Endpoint (PUB-SUB) in the ZMQ API.