Docs‎ > ‎OpenSource‎ > ‎

jldzeromq


This project consists in a collection of ZeroMQ related tools.  The source code can be found on Github. The Ohloh page is found here.

Related Projects


Scripts

jld0pub

ex:  jld0pub -sp socket [-tp topic] [-tf topic(s)] [-js]

This script consists in a simple message publisher. Two modes of operation are supported: TEXT & JSON.
In the TEXT mode, the script waits for either pattern:

msg\n

OR 

topic: msg\n

In the first case, the topic must be specified using the -tp option. In the JSON mode, the -tp option is not necessary and will be ignored.

jld0sub -sp tcp://127.0.0.1:9002
Will wait on stdin for a pattern 'topic: msg' and will transmit on the socket.

jld0sub -sp tcp://127.0.0.1:9002 -tp test
Will wait on stdin for a pattern 'msg' and will transmit on the socket with topic 'test'.

  • where 'topic' is a string representing a topic
  • where 'message' is taken from stdin
  • where '-tf' optionally specifies a list of topics to filter-out
  • where '-js' specifies the JSON mode of operation.

JSON mode

In this mode, the script expects JSON objects from stdin :

{    'topic' : topic
     , ...
}


jld0sub

This script consists in a simple message subscriber.

ex: jld0sub -ss socket [-tp topic [topic ...]] [-jmm] [-tpf topic [topic ...]] [-m module -f function -a args ]

jld0pub -ss tcp://*:9002/ -tp test2 allo4

If no topic is specified, then the script enters a snooping mode were all topics are subscribed to.
The '-jmm' means "just the message" i.e. only the message part will be sent to stdout.
Use '-tpf' to filter-out topics.
Use the options '-m', '-f' and '-a' to specify a python callable module.function(topic, msg, *args) to use as filter.  The function must return a tuple (topic, msg).

jld0send

This script is used to send "publish" messages to the fabric jld0fabric.

jld0send -sf fabric_socket [-tp specified_topic] [-js] [-tf topic]

Where '-tp' is used to specify a topic and thus only the message part can be sent over on stdin. Else the form "topic: msg" must be used.
Where '-js' means "json mode": a JSON message must be sent on stdin where the topic is specified in the object member 'topic'.
Where '-tf' are the topics to filter-out of the output stream on stdout.

jld0fabric

This script serves as a "message fabric" for publish/subscribe patterns.

ex:  jld0fabric -ps publisher_side_socket -ss subscriber_side_socket

The publisher_side_socket  is the one used to publish messages on the fabric.  Publishers (e.g. jld0send) must use this socket.
Conversely, the subscriber_side_socket  is used to subscribe to messages on the fabric.  Subscribers (e.g. jld0sub) must use this socket.

Example:

jld0fabric -ps tcp://127.0.0.1:9002 -ss tcp://*:9003

Subscribers could do:

jld0sub -ss tcp://localhost:9003 -jmm

Whilst Publishers would use:

jld0send -sf tcp://localhost:9002




Comments