Skip to content

Instantly share code, notes, and snippets.

@melo
Created August 1, 2012 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save melo/3226054 to your computer and use it in GitHub Desktop.
Save melo/3226054 to your computer and use it in GitHub Desktop.
mzp synopsis

mpz synopsis

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. Works fine for line- based streams.

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.

options

  • --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)

  • --balance: message is sent to one of the --connect's; --balance is required on the receiving end

  • --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

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;
  • --strip-tag: when outputing messages, strip the tag from messages. If not given, we'll output two lines per message, tag and payload.

N-to-N

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment