use of org.ballerinalang.siddhi.core.trigger.StartTrigger in project ballerina by ballerina-lang.
the class DefinitionParserHelper method addEventTrigger.
public static void addEventTrigger(TriggerDefinition triggerDefinition, ConcurrentMap<String, Trigger> eventTriggerMap, ConcurrentMap<String, StreamJunction> streamJunctionMap, SiddhiAppContext siddhiAppContext) {
if (!eventTriggerMap.containsKey(triggerDefinition.getId())) {
Trigger trigger;
if (triggerDefinition.getAtEvery() != null) {
trigger = new PeriodicTrigger();
} else if (triggerDefinition.getAt().trim().equalsIgnoreCase(SiddhiConstants.TRIGGER_START)) {
trigger = new StartTrigger();
} else {
trigger = new CronTrigger();
}
StreamJunction streamJunction = streamJunctionMap.get(triggerDefinition.getId());
trigger.init(triggerDefinition, siddhiAppContext, streamJunction);
siddhiAppContext.addEternalReferencedHolder(trigger);
eventTriggerMap.putIfAbsent(trigger.getId(), trigger);
}
}
Aggregations