Timers
Timing nodes are used to trigger events within a time range.
Attribute | Description | Data Type |
---|---|---|
Id | Id of the timing node | System.Guid |
Name | Name of the node | System.String |
Mode | Timing mode: (“Interval”; “ExactTime” exact timing in month, days, hours, minutes or seconds) | |
Interval | Interval in C# time span format, only valid if mode is Interval. e. g. 12.13:45:22.8262; = 12 days, 13 hours, 45 minutes 22.8262 seconds | System.TimeSpan |
InitialDelay | Initial delay before the first timer event is thrown. Zero means that the first call is done after the interval. | System.TimeSpan |
ExactSecond | Event at the given second | System.Int32 |
ExactMinute | Event at the given minute | System.Int32 |
ExactHour | Event at the given hour | System.Int32 |
ExactDay | Event at the given day | System.Int32 |
ExactMonth | Event at the given month | System.Int32 |
Example of a time firing the timer event every day at 01:30:00:
{
"Timers": [
{
"Id": "6B43DBD5-92FA-4304-8BDA-A2AB5793644A",
"Name": "Timer1",
"Mode": "ExactTime",
"ExactHour": 1,
"ExactMinute": 30,
}
]
}
Example of a time firing the timer event every hour, initially after 5min:
{
"Timers": [
{
"Id": "6B43DBD5-92FA-4304-8BDA-A2AB5793644A",
"Name": "Timer1",
"Mode": "Interval",
"Interval": "0.1:00",
"InitialDelay": "0.0:05",
}
]
}
Triggering Rules with Timers
Timer can be directly combined with rules. This allows to trigger rules within a period of time (interval) or at some exact time.
Example schema triggering a command after 30 min.
{
"Id": "D6680B09-3F70-4332-B8C5-603DE8E79252",
"Name": "HumanOS.Service.IdentityService.Objects.Schema",
"Timers": [
{
"Id": "6B43DBD5-92FA-4304-8BDA-A2AB5793644A",
"Name": "Timer1",
"Mode": "Interval",
"Interval": "0.00:30:00",
"ExactMinute": 30,
}
]
"Rules": [
{
"Name": "Rule1",
"Id": "511E2765-457C-43B9-8BE8-59E26F1B6768",
"Type": "GenericRule",
"TriggerEvent": "OnTimer",
"TriggerCondition": "Node.Name == 'Timer1'",
"Action": {
"Type": "Command",
"Arguments": [],
"CommandExpression": {
"Id": "CB00EE4E-AAE6-4C01-A9D8-C8E949D5AC6F",
"Arguments": []
}
}
}
]
}