zmqdump - dump zmq messages on a socket
zmqdump [options] socket_type endpoint
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
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.
bind to socket instead of connecting to it.
-hwm limit set a high water mark on the socket. Default is 1000.
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'
-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.