use of io.siddhi.query.api.definition.TriggerDefinition in project siddhi by wso2.
the class TriggerTestCase method testQuery1.
@Test
public void testQuery1() throws InterruptedException {
log.info("testTrigger1 - OUT 0");
SiddhiManager siddhiManager = new SiddhiManager();
TriggerDefinition triggerDefinition = TriggerDefinition.id("cseEventStream").atEvery(Expression.Time.milliSec(500));
SiddhiApp siddhiApp = new SiddhiApp("ep1");
siddhiApp.defineTrigger(triggerDefinition);
SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(siddhiApp);
siddhiAppRuntime.shutdown();
}
use of io.siddhi.query.api.definition.TriggerDefinition in project siddhi by wso2.
the class DefineTriggerTestCase method testTriggerDefinition.
@Test
public void testTriggerDefinition() {
TriggerDefinition triggerDefinition = new TriggerDefinition();
triggerDefinition.setQueryContextEndIndex(new int[1]);
triggerDefinition.setQueryContextStartIndex(new int[1]);
SiddhiApp.siddhiApp("test").defineTrigger(TriggerDefinition.id("TriggerStream").atEvery(Expression.Time.day(5).value()));
}
use of io.siddhi.query.api.definition.TriggerDefinition in project siddhi by wso2.
the class SiddhiAppRuntimeBuilder method defineTrigger.
public void defineTrigger(TriggerDefinition triggerDefinition) {
DefinitionParserHelper.validateDefinition(triggerDefinition);
TriggerDefinition currentDefinition = triggerDefinitionMap.putIfAbsent(triggerDefinition.getId(), triggerDefinition);
if (currentDefinition != null) {
triggerDefinition = currentDefinition;
}
DefinitionParserHelper.addEventTrigger(triggerDefinition, triggerMap, streamJunctionMap, siddhiAppContext);
}
use of io.siddhi.query.api.definition.TriggerDefinition in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitDefinition_trigger.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public Object visitDefinition_trigger(@NotNull SiddhiQLParser.Definition_triggerContext ctx) {
TriggerDefinition triggerDefinition = TriggerDefinition.id((String) visitTrigger_name(ctx.trigger_name()));
if (ctx.time_value() != null) {
triggerDefinition.atEvery(visitTime_value(ctx.time_value()).value());
} else {
triggerDefinition.at(visitString_value(ctx.string_value()).getValue());
}
populateQueryContext(triggerDefinition, ctx);
return triggerDefinition;
}
use of io.siddhi.query.api.definition.TriggerDefinition in project siddhi by wso2.
the class DefineTriggerTestCase method testTriggerEventIdNull.
@Test(expectedExceptions = SiddhiAppValidationException.class)
public void testTriggerEventIdNull() {
TriggerDefinition trigger = TriggerDefinition.id(null);
SiddhiApp.siddhiApp("test").defineTrigger(trigger);
}
Aggregations