mpz is a ZeroMQ-based pipe.
It will read stuff from STDIN and output to ZeroMQ sockets, and read from ZeroMQ sockets and send to STDOUT.
Messages are terminated by newlines, or pairs of newlines in paragraph mode.
Supports 1-to-1, 1-to-N and N-to-1. There is a special mode to start as a forwarder to support N-to-N topologies.
--bind: address to bind, should be used on the N side of the pipe. multiple uses allowed;
--connect: address to connect to, should be used on the 1 side; multiple uses allowed, depending on the socket type, sends to all or round-robin's between them;
--broadcast: message is sent to all --connect's; --broadcast is required on the receiving end (its the default, so you can ignore it on the receiving end)
XXX That doesn't seem to make sense, or is redundant. Perhaps just remove everything after the semicolon.
- --balance: message is sent to one of the --connect's; --balance is required on the receiving end
XXX This seems fuzzy too. What happens if --balance isn't specified on the receiving end?
XXX What happens if neither are specified but there are multiple connects? XXX What happens if both are specified? Are they mutually exclusive? XXX If so maybe --mode=X
- --time-limit=n: stop running after N seconds
- --message-limit=n: stop running after N messages
If you use both, we'll stop after the first one is satisfied.
- --paragraph: work in paragraph mode, so each message is separated by an empty line
XXX is the double newline part of the message? XXX Allow for arbitrary separators, like \0 (think find -print0) XXX delimiters vs terminators? Included in the message or not? XXX Talk about LF vs CRLF and encodings. XXX Talk about EOF-without-terminator handling (premature EOF)
This next ones only apply to --broadcast mode:
--tag=s: tag each message with string s - we'll use multi-part ZeroMQ messages when this is activated, first part is the tag;
--filter=s: filter each message based on the tag. Prefix-match is used. Can be used multiple times;
XXX Is prefix-match a wise default? Make optional? Make regex?
- --strip-tag: when outputing messages, strip the tag from messages. If not given, we'll output two lines per message, tag and payload.
XXX Perhaps generalize to --out-fmt "%s\n%s\n" (the sprintf format offers XXX lots of flexibility, including argument ordering). XXX That suggestion relates back to the issue of delimiters vs terminators. XXX I.e. is the separator (newline) included in the message. I presume not.
To implement N-to-N you need an extra process that sits in the middle of two connections 1->N and N->1.
Still working out the details of this part, specially how-to spec the command line to mix pubsub with push/pull to load-balance
- --forwarder: enables a special process that will forward all messages received...
- --balancer: receive messages and round-robin them to the destinations
XXX clarifying everything else above may help with this.