dump zmq messages on a socket
Python
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
test Rearranged methods Dec 31, 2013
LICENSE Initial commit Dec 30, 2013
README.md Update README.md Dec 31, 2013
setup.py updated setup.py Feb 9, 2014
zmqdump Added setup.py and version information. Feb 9, 2014

README.md

zmqdump

NAME

zmqdump - dump zmq messages on a socket

SYNOPSIS

zmqdump [options] socket_type endpoint

DESCRIPTION

The zmqdump utility is used to make zmq socket communication available on the unix shell. It can be used to listen to messages on SUB and PULL sockets and to send messages out via PUB, PUSH sockets.

The default behavior will dump all revceived messages on stdout; all lines(!) received on stdin will be sent out as string messages.

Common uses include:

  • network testing
  • simple zmq proxies
  • shell script based zmq applications

The options are as follows:

  • The socket_type can be one of the following options "PUB", "SUB", "PUSH", "PULL" (tbd: "PAIR", "REQ", "REP", "ROUTER", "DEALER").

  • The endpoint is a string consiting of two parts:

      endpoint = transport://address
    

    The transport part specifies the underlying transport protocol and can be one of the following options: "inproc", "ipc", "tcp", "pgm", "epgm". The address syntax is protocl dependent (cf. http://api.zeromq.org/4-0:zmq-bind)

  • -d delay spefifies an initial delay in milliseconds before sending out messages in order to address the slow joiner syndrom.

  • -s pattern is only relevant for the "SUB" socket type. It allows to subscribe to specific patterns. The default is ("") - subscription to all messages.

  • -b, --bind
    bind to socket instead of connecting to it.

  • -hwm limit set a high water mark on the socket. Default is 1000.

EXAMPLES

Capture all messages on a PUB socket to a file:

zmqdump SUB tcp://127.0.0.1:5000 > filename.out

Distribute lines of a file on a PUSH socket

zmqdump --bind PUSH tpc://*:5000 < filename.in

Publish output of a script on socket:

./script | zmqdump --bind PUSH tpc://*:5000

Capitalize all recieved messages

zmqdump -b PULL $IN_EP | sed -u 's/[^ _-]*/\u&/g'

Remark: The -u switch turns off buffering of stdin/stdout it is also used in the python invocation.

Keep this running and open another terminal. Execute

zmqdump PUSH $IN_EP

and start typing.