Vanilla config.json usage - PIONEER-Experiment/zmq_publisher GitHub Wiki

Default config.json

{
    "general-settings": {
        "verbose": 2
    },
    "data-channels": {
        "example-channel": {
            "enabled": true,
            "zmq-address": "tcp://127.0.0.1:5555",
            "name": "EXAMPLE",
            "publishes-per-batch": 1,
            "publishes-ignored-after-batch": 0,
            "num-events-in-circular-buffer": 5,
            "processors": [
                {
                    "processor": "CommandProcessor",
                    "command": "echo Hello World",
                    "period-ms": 1000
                }
            ]
        }
    }    
}

Breakdown

General Settings

"general-settings": {
    "verbose": 2
},

Only one entry in general-settings by default:

"verbose": (int) -- This controls the amount of text output. Subsequent levels include all verbosity of previous levels.

  • 0 -- no output
  • 1 -- output when a publish is made as well as channel (topic) statistics
  • 2 -- output truncated published message
  • 3 -- output full published message

NOTE: This works in conjunction with spdlog. These are effectively finer levels of debug print when spdlog logging level is set to debug or higher.

Data Channels

"data-channels": {
     "example-channel": { ...
     }
}

Acts as a list of channels (or topics). Each distinct topic needs one of these.

Data Channel Settings

      "example-channel": {
            "enabled": true,
            "zmq-address": "tcp://127.0.0.1:5555",
            "name": "EXAMPLE",
            "publishes-per-batch": 1,
            "publishes-ignored-after-batch": 0,
            "num-events-in-circular-buffer": 5,
            "processors": [
                {
                    "processor": "CommandProcessor",
                    "command": "echo Hello World",
                    "period-ms": 1000
                }
            ]
        }

"enabled": (boolean) -- Whether the channel is considered when publishing

"zmq-address": (string) -- The address which the data will be published to.

"name": (string) -- The channel (topic) name that ZeroMQ will use when publishing. An empty string will still be published, but not under a topic.

"publishes-per-batch": (int) -- Number of publishes before the channel will "take a break" from publishing

"publishes-ignored-after-batch": (int) -- Number of publishes ignored when a channel is "taking a break". Set to 0 for no breaks to be taken.

"num-events-in-circular-buffer": (int) -- Length of the circular buffer array. Processors add to the circular buffer.

Processors

            "processors": [
                {
                    "processor": "CommandProcessor",
                    "command": "echo Hello World",
                    "period-ms": 1000
                }
            ]

A list of processors. Processors generate a list of strings to be added to the circular buffer which is published to the specified channel.

"processor": (string) -- The name of the processor. This MUST be registered by linking the string to some derived class of GeneralProcessor in main.cpp using the GeneralProcessorFactory.cpp

"period-ms": (int) -- The minimum amount of time in milliseconds between subsequent executions of the processor. The actual period of publishing may be longer depending on how long it takes the processor to run.

"command": (string) -- If the processor given is a derived class of CommandProcessor (which is derived from General Processor), you can specify a command to be run. The output of the command will be added to the circular buffer as a string.