Agent Setup


Once running, you have to set up your Agent to listen a specific environment:

zenaton listen <parameters>

Your parameters can be in a .env file, then you need to provide it:

zenaton listen --env=<path/to/.env/file>

or can be inlined:

zenaton listen --<name>=<value>

If you mix both notations, inlined parameters will be prioritized.

# Parameters

NAME INLINED DEFAULT DESCRIPTION
env "./.env" location of .env file containing configuration
ZENATON_BOOT_FILE boot none location of the mandatory boot file
ZENATON_APP_ID app_id none Your application id - to listen only to workflows started by your application (refer to Zenaton API section);
ZENATON_API_TOKEN api_token none your API token - to prove you have rights to access above application (refer to Zenaton API section);
ZENATON_APP_ENV app_env none your Zenaton environment - to distinguish workflows launched in production from workflows launched during development - typically "production", "staging", "dev" or your first name.
ZENATON_CONCURRENT_MAX concurrent_max 10 Maximum number of tasks and decisions that the Agent can process concurrently
ZENATON_LISTEN_TIMEOUT 10 Timeout in seconds for the listen command. You might want to increase this value if your application takes more than 10 seconds to boot.

# Boot file

The Agent will require your boot file before processing any tasks or decisions. This boot file tells the Agent which functions are related to tasks and workflows name. So a typical boot file will look like:

const { workflow, task } = require("zenaton");

// defining workflows
workflow("firstWorkflow", require("./MyFirstWorkflow"));
workflow("secondWorkflow", require("./MySecondWorkflow"));

// defining tasks
task("firstTask", require("./MyFirstTask"));
task("secondTask", require("./MySecondTask"));

If you dispatch a task or a workflow that is not declared in this file, then the corresponding task or workflow will not be processed.