Search in sources :

Example 1 with CronTrigger

use of org.wso2.siddhi.core.trigger.CronTrigger in project siddhi by wso2.

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);
    }
}
Also used : CronTrigger(org.wso2.siddhi.core.trigger.CronTrigger) StartTrigger(org.wso2.siddhi.core.trigger.StartTrigger) Trigger(org.wso2.siddhi.core.trigger.Trigger) CronTrigger(org.wso2.siddhi.core.trigger.CronTrigger) PeriodicTrigger(org.wso2.siddhi.core.trigger.PeriodicTrigger) StreamJunction(org.wso2.siddhi.core.stream.StreamJunction) StartTrigger(org.wso2.siddhi.core.trigger.StartTrigger) PeriodicTrigger(org.wso2.siddhi.core.trigger.PeriodicTrigger)

Aggregations

StreamJunction (org.wso2.siddhi.core.stream.StreamJunction)1 CronTrigger (org.wso2.siddhi.core.trigger.CronTrigger)1 PeriodicTrigger (org.wso2.siddhi.core.trigger.PeriodicTrigger)1 StartTrigger (org.wso2.siddhi.core.trigger.StartTrigger)1 Trigger (org.wso2.siddhi.core.trigger.Trigger)1