Java Code Examples for io.siddhi.query.api.execution.query.output.stream.OutputStream#OutputEventType

The following examples show how to use io.siddhi.query.api.execution.query.output.stream.OutputStream#OutputEventType . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SiddhiQLBaseVisitorImpl.java    From siddhi with Apache License 2.0 5 votes vote down vote up
/**
     * {@inheritDoc}
     * <p>The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.</p>
     *
     * @param ctx
     */
    @Override
    public OutputStream.OutputEventType visitOutput_event_type(@NotNull SiddhiQLParser.Output_event_typeContext ctx) {
//        output_event_type
//        : ALL EVENTS | EXPIRED EVENTS | CURRENT? EVENTS
//        ;

        if (ctx.ALL() != null) {
            return OutputStream.OutputEventType.ALL_EVENTS;
        } else if (ctx.EXPIRED() != null) {
            return OutputStream.OutputEventType.EXPIRED_EVENTS;
        } else {
            return OutputStream.OutputEventType.CURRENT_EVENTS;
        }
    }
 
Example 2
Source File: Query.java    From siddhi with Apache License 2.0 5 votes vote down vote up
public void updateOrInsertBy(String outputTableId, OutputStream.OutputEventType outputEventType,
                             UpdateSet updateSetAttributes, Expression onUpdateExpression) {
    this.outputStream = new UpdateOrInsertStream(outputTableId, outputEventType, updateSetAttributes,
            onUpdateExpression);
    updateOutputEventType(outputRate, outputStream);

}
 
Example 3
Source File: Window.java    From siddhi with Apache License 2.0 5 votes vote down vote up
StreamPublishProcessor(OutputStream.OutputEventType outputEventType) {
    this.outputEventType = outputEventType;
    this.allowCurrentEvents = (outputEventType == OutputStream.OutputEventType.CURRENT_EVENTS ||
            outputEventType == OutputStream.OutputEventType.ALL_EVENTS);
    this.allowExpiredEvents = (outputEventType == OutputStream.OutputEventType.EXPIRED_EVENTS ||
            outputEventType == OutputStream.OutputEventType.ALL_EVENTS);
}
 
Example 4
Source File: Query.java    From siddhi with Apache License 2.0 4 votes vote down vote up
public Query insertInto(String outputStreamId, OutputStream.OutputEventType outputEventType) {
    this.outputStream = new InsertIntoStream(outputStreamId, outputEventType);
    updateOutputEventType(outputRate, outputStream);
    return this;
}
 
Example 5
Source File: Query.java    From siddhi with Apache License 2.0 4 votes vote down vote up
public Query insertIntoInner(String outputStreamId, OutputStream.OutputEventType outputEventType) {
    this.outputStream = new InsertIntoStream(outputStreamId, true, outputEventType);
    updateOutputEventType(outputRate, outputStream);
    return this;
}
 
Example 6
Source File: Query.java    From siddhi with Apache License 2.0 4 votes vote down vote up
public Query insertIntoFault(String outputStreamId, OutputStream.OutputEventType outputEventType) {
    this.outputStream = new InsertIntoStream(outputStreamId, false, true, outputEventType);
    updateOutputEventType(outputRate, outputStream);
    return this;
}
 
Example 7
Source File: Query.java    From siddhi with Apache License 2.0 4 votes vote down vote up
public Query returns(OutputStream.OutputEventType outputEventType) {
    this.outputStream = new ReturnStream(outputEventType);
    updateOutputEventType(outputRate, outputStream);
    return this;
}
 
Example 8
Source File: Query.java    From siddhi with Apache License 2.0 4 votes vote down vote up
public void deleteBy(String outputTableId, OutputStream.OutputEventType outputEventType, Expression
        onDeletingExpression) {
    this.outputStream = new DeleteStream(outputTableId, outputEventType, onDeletingExpression);
    updateOutputEventType(outputRate, outputStream);
}
 
Example 9
Source File: Query.java    From siddhi with Apache License 2.0 4 votes vote down vote up
public void updateBy(String outputTableId, OutputStream.OutputEventType outputEventType,
                     Expression onUpdateExpression) {
    this.outputStream = new UpdateStream(outputTableId, outputEventType, null, onUpdateExpression);
    updateOutputEventType(outputRate, outputStream);
}
 
Example 10
Source File: Query.java    From siddhi with Apache License 2.0 4 votes vote down vote up
public void updateBy(String outputTableId, OutputStream.OutputEventType outputEventType,
                     UpdateSet updateSetAttributes, Expression onUpdateExpression) {
    this.outputStream = new UpdateStream(outputTableId, outputEventType, updateSetAttributes, onUpdateExpression);
    updateOutputEventType(outputRate, outputStream);
}
 
Example 11
Source File: Window.java    From siddhi with Apache License 2.0 4 votes vote down vote up
/**
 * Initialize the WindowEvent table by creating {@link WindowProcessor} to handle the events.
 *
 * @param tableMap         map of {@link Table}s
 * @param eventWindowMap   map of EventWindows
 * @param windowName       name of the query window belongs to.
 * @param findToBeExecuted will find will be executed on the window.
 */
public void init(Map<String, Table> tableMap, Map<String, Window> eventWindowMap, String windowName,
                 boolean findToBeExecuted) {
    if (this.windowProcessor != null) {
        return;
    }

    // Create and initialize MetaStreamEvent
    MetaStreamEvent metaStreamEvent = new MetaStreamEvent();
    metaStreamEvent.addInputDefinition(windowDefinition);
    metaStreamEvent.setEventType(MetaStreamEvent.EventType.WINDOW);
    for (Attribute attribute : windowDefinition.getAttributeList()) {
        metaStreamEvent.addOutputData(attribute);
    }

    this.streamEventFactory = new StreamEventFactory(metaStreamEvent);
    StreamEventCloner streamEventCloner = new StreamEventCloner(metaStreamEvent, this.streamEventFactory);
    OutputStream.OutputEventType outputEventType = windowDefinition.getOutputEventType();
    boolean outputExpectsExpiredEvents = outputEventType != OutputStream.OutputEventType.CURRENT_EVENTS;

    SiddhiQueryContext siddhiQueryContext = new SiddhiQueryContext(siddhiAppContext, windowName);
    WindowProcessor internalWindowProcessor = (WindowProcessor) SingleInputStreamParser.generateProcessor
            (windowDefinition.getWindow(), metaStreamEvent, new ArrayList<VariableExpressionExecutor>(),
                    tableMap, false,
                    outputExpectsExpiredEvents, findToBeExecuted, siddhiQueryContext);
    internalWindowProcessor.setStreamEventCloner(streamEventCloner);
    internalWindowProcessor.constructStreamEventPopulater(metaStreamEvent, 0);

    EntryValveProcessor entryValveProcessor = null;
    if (internalWindowProcessor instanceof SchedulingProcessor) {
        entryValveProcessor = new EntryValveProcessor(this.siddhiAppContext);
        Scheduler scheduler = SchedulerParser.parse(entryValveProcessor, siddhiQueryContext);
        scheduler.init(this.lockWrapper, windowName);
        scheduler.setStreamEventFactory(streamEventFactory);
        ((SchedulingProcessor) internalWindowProcessor).setScheduler(scheduler);
    }
    if (entryValveProcessor != null) {
        entryValveProcessor.setToLast(internalWindowProcessor);
        this.windowProcessor = entryValveProcessor;
    } else {
        this.windowProcessor = internalWindowProcessor;
    }

    // StreamPublishProcessor must be the last in chain so that it can publish the events to StreamJunction
    this.windowProcessor.setToLast(new StreamPublishProcessor(outputEventType));
    this.internalWindowProcessor = internalWindowProcessor;
}
 
Example 12
Source File: SiddhiQueryContext.java    From siddhi with Apache License 2.0 4 votes vote down vote up
public OutputStream.OutputEventType getOutputEventType() {
    return outputEventType;
}
 
Example 13
Source File: SiddhiQueryContext.java    From siddhi with Apache License 2.0 4 votes vote down vote up
public void setOutputEventType(OutputStream.OutputEventType outputEventType) {
    this.outputEventType = outputEventType;
}
 
Example 14
Source File: WindowDefinition.java    From siddhi with Apache License 2.0 2 votes vote down vote up
/**
 * Return the output event type of the window.
 *
 * @return the output event type
 */
public OutputStream.OutputEventType getOutputEventType() {
    return outputEventType;
}
 
Example 15
Source File: WindowDefinition.java    From siddhi with Apache License 2.0 2 votes vote down vote up
/**
 * UpdateSet output event type of the window. If not explicitly assigned, OutputEventType.ALL_EVENTS
 * will be used by default.
 *
 * @param outputEventType the output event type
 */
public void setOutputEventType(OutputStream.OutputEventType outputEventType) {
    this.outputEventType = outputEventType;
}