-
Notifications
You must be signed in to change notification settings - Fork 2
PUB/SUB Interface #3
Comments
Sounds great! One thing that would be nice is to avoid having to specify the ip address and port; that should be configured automatically somehow, probably by asking the process manager or something. I think I saw functions in zeromq for using random port numbers, so there may be some level of automation build into zmq already. Idealy we can just use the hostname of the machine its running on. |
Carl, I found on the ZeroMQ documentation that they use a '*' as a wildcard operator for the publisher's socket (but not for the subscription's connection to the publisher's socket). We can check to see by experimentation if we can use the same wildcard operator for the subscription's connection. I read their example on getting the message out: For randomly specifying the IP address, I haven't found anything in their guide that would allow us to generate random sockets. However, it could be possible if we use proxies and create IPs buy generating random numbers on our own. Other than that, I don't mind using IP addresses to specify the sockets for each device. I'm guessing that if we were to exclude the IP addresses, it may defeat the purpose of decentralization (which is going against the purpose of ZeroMQ). |
The IP addresses would be configured either by a physical router using DHCP or manually assigned static IPs, so all we should need is a proxy to do all the routing. I was thinking one of the functional components of the process manager would be this proxy. Although it may become a bottle neck at some point, that is a backend problem that can be changed without effecting rover modules themselves. @wjtan360-git have you tried using the * wildcard on the subscribers socket? I suspect it won't work as that is saying "listen to every IP address on the internet", but ZeroMQ does many fancy things under the hood so I could be wrong. |
To allow for easier subscription to 0MQ sockets.
The publish/subscribe model should be used for metrics and sensor data.
I propose using a Uniform Resource Identifier (URI) scheme for our published messages which will allow for easy identification of where information is coming from. In addition to this, all messages should be able to be serialized to JSON.
I will be using the following hypothetical publishers as an example:
A temperature sensor
tcp://10.0.0.1:5000
tcp://10.0.0.1:5000/temperature/celsius
tcp://10.0.0.1:5000/temperature/fahrenheit
A GPS receiver
tcp://10.0.0.2:6000
tcp://10.0.0.2:6000/gps/location
I propose an API that could conform to the following code. The code in this issue is pseudo-python.
The output of the subscriber will look something like this:
The text was updated successfully, but these errors were encountered: