Dispatchers

In Extra Horizon, you can create Dispatchers which trigger Actions based on incoming events. You can manage these Dispatchers and their Actions using the Extra Horizon CLI by creating and consuming a JSON file containing all your Dispatchers. This JSON file can then be easily managed through version control and the CLI will help you to synchronize the Dispatchers with Extra Horizon.

For information regarding Dispatchers and the Dispatcher Service please refer to the Dispatcher Service documentation.

Synchronizing Dispatchers

Command

exh dispatchers sync

This command provides the functionality to read a locally declared Dispatchers file and synchronize the contents with existing Dispatchers.

A tag with value EXH_CLI_MANAGED will be appended to Dispatchers created with the CLI.

The CLI will only consider Dispatchers with the EXH_CLI_MANAGED tag for updates or deletions.

Arguments

--file

This required argument must point to the JSON file containing the array of Dispatchers to be synchronized.

--clean

This optional argument will delete all Dispatchers with the EXH_CLI_MANAGED tag that are not present in the local Dispatchers file.

The --clean argument performs a destructive operation that can not be reverted.

Example

exh dispatchers sync --file=./path/to/dispatchers.json --clean

File format

Dispatchers must be provided in a .json file as defined in the arguments section. This file must contain an array of Dispatcher objects as shown in the example below.

For detailed information regarding the structure of a Dispatcher, please refer to the section Create your first Dispatcher.

Example

[
  {
    "eventType": "my-event-type",
    "name": "my-unique-dispatcher-name",
    "description": "A Dispatcher that handles my-event-type",
    "actions":[
      {
        "type": "task",
        "name": "my-unique-action-name",
        "description": "A Task Action that handles my-event-type",
        "functionName": "my-function-name",
        "data": {
          "customStringField": "myStringHere",
          "customNumberField": 42
        },
        "startTimestamp": "2024-01-01T00:00:00.000Z",
        "tags":[
          "tag1",
          "tag2"
        ]
      }
    ],
    "tags": [
      "tag1",
      "tag2"
    ]
  }
]

Last updated