Agent Data Synchronization
Resources
Sync Agents
Sync agents are a more powerful and configurable ways of defining tasks that must perform under a given sequence, dependency tree, or schedule. They can be configured in a number of ways that allow for very complex and fine grain control over how and when they execute.
A few of examples of why we would use a sync agent:
A task or job needs to be fired at a given time
We need the ability to schedule something in a different time zone
We want to request that an agent performs it's refresh from a remote source (like a database)
The task is dependant on other tasks completing
We have data that may expire if not kept current
We need to supply multiple CRON strings to specify which times the task runs
We need to supply a blackout range where the task should not be executed
Agent callbacks
Agents have several main blocks to them, they are as follows:
The first callback is the configuration section. We can set all kinds of settings including:
Maximum executions per day.
A timespan of how often to execute
An array of CRON strings to specifiy when to execute
Blackout periods in the form of Timespan and CRON strings.
Setting "* 5 * * *" as a blackout CRON would disallow the agent to run during the entire fifth hour of the day (from 5:00AM to 5:59AM inclusive)
The execution callback
This callback is only ever called when the agent is in an active refresh/sync state.
You can perform whatever logic you need here, and simply return exec.Complete or exec.Failure depending on the results of your process
Tree check callback
This callback is only for late binding trees, in the below example you can see how it's used to setup a behavior tree for checking previous agent runs
Example - Three agents configuration
In the below example we configure 3 agents.
The first is run every 5 seconds, once a day.
The second is run on the minute 0 mark, once a day.
The level 2 agent has a late binding dependency tree to check to determine whether the first two succeeded and the data is not expired. If this is true, then it runs
Last updated