-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Message format #20
Comments
This is a high-level issue, I expect we will farm out details to separate issues later. |
A few comments regarding zmq's working:
Consequences for us:
Some more ideas regarding content:
Ideas regarding the command type:
Regarding logging:
|
I read a bit on the subway today, it really looks like a good option; this would also take some of the handshaking, capability listing, reply tracking, message verification (with schema), RPC burden from us. zmq would probably mostly be the transport layer (so one frame per avro message; plus maybe the topic frame). JSON or binary option. Implementations for several languages. Yaq notes on why/how they use avro: https://yeps.yaq.fyi/107/ |
Here is another description of some message format (of a protocol a colleague recommended, but probably not that good a fit for our use case), could inform us regarding the message structure: https://en.wikipedia.org/wiki/Constrained_Application_Protocol#Message_formats |
To answer one question here:
In zmq, at least two endpoints of communication need to be defined in a fixed way, i.e. you define a certain communication channel, similar to tcp/ip (on which it builds), which is an IP adress and a port, i.e. a socket. In that sense, for our case, all the non-Coordinator nodes talk to the Coordinator in a more or less hardcoded way, their messages always go to/through to Coordinator by default, thus we do not need to give a Coordinator's ID in this message. |
Here the "names" come into play:
With that protocol, the header does not change and each hop just knows, how to reach the next hop. |
Well, maybe we want to make a separate issue out of that, since it pops up again and again xD Regarding the format, I guess we should first distinguish how precise we want to control what happens ourselves. If we are to use the PUB-SUB (with XPUB and XSUB sockets on the proxy) for a certain channel, the makeup of the frames which we control ourselves will be different than if we do it purely with ROUTER and DEALER sockets. The PUB-SUB sockets cannot be connected to ROUTER/DEALER sockets (without errors or undocumented/unpredictable results).
|
zmq only considers the first frame for "topic filtering". The rest of the message is just a simple message consisting in 0 or more frames. |
Ok, then we can actually make a common Header for both data and control protocols:
This will keep a bit of overhead in the data-channel (recipients and conversation ID are unnecessary here), but we can keep it the same across the different channels. The same is true for the logging channel (if we now separate it with its own PUB-SUB proxy), recipients and reply-reference are unnecessary. |
What I'm not clear on is how the Avro messages fit into the whole thing (e.g. this) -- are the Avro messages completely contained in the zmq payload? Where/how do we disntiguish what goes in the zmq header, and what into the Avro message? Do we duplicate information, or is the distinction clear anyway (e.g. zmq header: only message/routing metadata). |
My idea is, that we have a routing header (I prefer the first frame), which contains the addresses and message ID etc., and then the payload in all the other frames. So yes, we have frame 0 for Zmq routing stuff and frames 1 to n for the apache avrò payload. |
My notes/draft on the message format, so far. For alignment/discussion, this is a quick first shot.
Message format
We have different message types:
Control messages
Data messages
Logging messages
TBC more?
F1: Do we want a plain-text (SCPI-like) protocol or a binary encoded one? E.g. do we have plaintext command verbs like
GET
or opcodes like0x02
that are defined in a table somewhere?Message structure
All messages have the same base structure:
Header
Timestamp
Message ID (possibly UUID v7 including timestamp) Message identifier #16
1 Sender
0 or more recipients (pub-sub messages don't have a recipient afaict)
0 or 1 reply-reference
Probably payload length (for knowing when the checksum starts)(zmq delivers the whole message in one)Regarding the formatting of the header, see Control protocol header format #33
H1: How does a coordinator get the message if the recipient is another Node? Do we also need to give the Coordinator's ID?
H2: Can we manage a common header for data, control and logging messages?
Control Payload
<CMD> [<args>]+
<CMD>
is from a command dictionarySET
GET
CALL
RESET
ERROR
LIST_PARAMS
LIST_ACTIONS
...
C1: Should an argument always be a key-value pair, or do we stay plain sequence of tokens?
That is, is
prop1 15.2 prop2 true
2 or 4 args` What about arguments without value?C2: Is every token in the message a zeromq "frame"? Can we decide what goes in a frame?
Data Payload
TODO, didn't have time to define yet.
Logging Payload
TODO, didn't have time to define yet.
Checksum
TBD, some universally acceptable CRC check, I guess?
The text was updated successfully, but these errors were encountered: