Initial Design Cut: The Protocol

The full name for the protocol is the File Message Queuing Protocol, or FILEMQ (in uppercase, to distinguish it from the software). To start with, we write down the protocol as an ABNF grammar. Our grammar starts with the flow of commands between the client and server. You should recognize these as a combination of the various techniques we’ve seen already:

filemq-protocol = open-peering *use-peering [ close-peering ]

open-peering    = C:OHAI *( S:ORLY C:YARLY ) ( S:OHAI-OK / error )

use-peering     = C:ICANHAZ ( S:ICANHAZ-OK / error )
                / C:NOM
                / S:CHEEZBURGER
                / C:HUGZ S:HUGZ-OK
                / S:HUGZ C:HUGZ-OK

close-peering   = C:KTHXBAI / S:KTHXBAI

error           = S:SRSLY / S:RTFM

Here are the commands to and from the server:

; The client opens peering to the server OHAI = signature %x01 protocol version signature = %xAA %xA3 protocol = string ; Must be "FILEMQ" string = size *VCHAR size = OCTET version = %x01 ; The server challenges the client using the SASL model ORLY = signature %x02 mechanisms challenge mechanisms = size 1*mechanism mechanism = string challenge = *OCTET ; 0MQ frame ; The client responds with SASL authentication information YARLY = %signature x03 mechanism response response = *OCTET ; 0MQ frame ; The server grants the client access OHAI-OK = signature %x04 ; The client subscribes to a virtual path ICANHAZ = signature %x05 path options cache path = string ; Full path or path prefix options = dictionary dictionary = size *key-value key-value = string ; Formatted ...

Get ZeroMQ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.