Events
Events are used for historicization purposes.
Once a rule is triggered, the Connhex Rules Engine service generates an event. This event is then stored, together with a complete snapshot containing all the information about the conditions that triggered the rule.
This allows you to have a complete history of the events that have occurred, and to be able to reconstruct the conditions that have led to the execution of a rule. This is particularly useful in the case of changes to the conditions of a rule, which would otherwise make it impossible to reconstruct the conditions that led to the execution of the rule.
Moreover, the trigger and reentry of each condition are historicized too. This allows, for example, in the case of a threshold change over time, to keep track of the threshold value that actually triggered the condition at that time.
Structure
export interface CptConditionEvent {
id: string;
conditionId: string;
conditionSnapshot: CptCondition;
status: CptActivityStatus;
createdAt: string;
}
export interface CptRuleEvent {
id: string;
ruleId: string;
conditionEvents: CptConditionEvent[];
status: CptActivityStatus;
createdAt: string;
}
In particular:
conditionId
andconditionSnapshot
uniquely identify a condition at a given timeconditionEvents[]
represents the reference between the rule and conditions associated with it at the time of the event.