FairMQ/fairmq/options
Matthias Richter e184610c06 Adding parser implementation for key-value subopt format
A parser implementation for FairMQ channel properties.
The parser handles a comma separated key=value list format by using the
getsubopt function of the standard library.

The option key '--channel-config' can be used with the list of key/value
pairs like e.g.
--channel-config name=output,type=push,method=bind
2017-04-20 11:07:46 +02:00
..
ProgOptionTest all: apply fer-json-fmt 2016-11-10 15:20:54 +01:00
FairMQEventManager.h Update JSON files & readme, use FairMQDevicePtr, cleanup. 2016-11-09 15:01:40 +01:00
FairMQParser.cxx Adding multiple transports support & other fixes: 2017-02-23 06:47:09 +01:00
FairMQParser.h Enable new callback API 2016-09-30 14:36:35 +02:00
FairMQProgOptions.cxx Remove unused code. 2017-03-14 17:51:26 +01:00
FairMQProgOptions.h Update JSON files & readme, use FairMQDevicePtr, cleanup. 2016-11-09 15:01:40 +01:00
FairMQSuboptParser.cxx Adding parser implementation for key-value subopt format 2017-04-20 11:07:46 +02:00
FairMQSuboptParser.h Adding parser implementation for key-value subopt format 2017-04-20 11:07:46 +02:00
FairProgOptions.cxx Enable new callback API 2016-09-30 14:36:35 +02:00
FairProgOptions.h Update JSON files & readme, use FairMQDevicePtr, cleanup. 2016-11-09 15:01:40 +01:00
FairProgOptionsHelper.h Update JSON files & readme, use FairMQDevicePtr, cleanup. 2016-11-09 15:01:40 +01:00
README.md fairmq/options: fix JSON example 2016-11-10 10:55:50 +01:00
runConfigEx.cxx Convert factory methods to return smart ptrs 2016-11-18 14:19:16 +01:00
startConfigExample.sh.in Enable new callback API 2016-09-30 14:36:35 +02:00

FairMQParser

The FairMQParser configures the FairMQ channels from a JSON file.

The basic structure looks like this:

{
    "fairMQOptions":
    {
        "devices":
        [{
            "id": "device1",
            "channels":
            [{
                "name": "data",
                "sockets":
                [{
                    "type": "push",
                    "method": "bind",
                    "address": "tcp://127.0.0.1:5555",
                    "sndBufSize": 1000,
                    "rcvBufSize": 1000,
                    "rateLogging": 1
                }]
            }]
        }]
    }
}

The top level key is fairMQOptions, followed by one or more devices (with their IDs), each containing one or more channels (with their names), each containing one or more sockets.

The socket parameters accept following values:

  • type (default = ""): "push"/"pull", "pub"/"sub", "req"/"rep", "xsub"/"xpub", "dealer/router", "pair".
  • method (default = ""): "bind"/"connect".
  • address (default = ""): address to bind/connect.
  • sndBufSize (default = 1000): socket send queue size in number of messages.
  • rcvBufSize (default = 1000): socket receive queue size in number of messages.
  • rateLogging (default = 1): log socket transfer rates in seconds. 0 for no logging of this socket.

If a parameter is not specified, its default value will be set.

When a channel has multiple sockets, sockets can share common parameters. In this case specify the common parameters directly on the channel, which will be applied to all sockets of the channel. For example, the following config will create 3 sockets for the data channel with same settings, except the address:

{
    "fairMQOptions":
    {
        "devices":
        [{
            "id": "device1",
            "channels":
            [{
                "name": "data",
                "type": "push",
                "method": "connect",
                "sockets":
                [
                    { "address": "tcp://127.0.0.1:5555" },
                    { "address": "tcp://127.0.0.1:5556" },
                    { "address": "tcp://127.0.0.1:5557" }
                ]
            }]
        }]
    }
}

The device ID should be unique within a topology. It is possible to create a configuration that can be shared by multiple devices, by specifying "key" instead of "id". To use it the started device must be started with --config-key <key> option. For example, the following config can be applied to multiple running devices within a topology:

{
    "fairMQOptions":
    {
        "devices":
        [{
            "key": "processor",
            "channels":
            [{
                "name": "data",
                "socket":
                {
                    "type": "pull",
                    "method": "connect",
                    "address": "tcp://localhost:5555"
                }
            }]
        }]
    }
}