Java Code Examples for io.siddhi.query.api.execution.query.output.stream.OutputStream#getId()

The following examples show how to use io.siddhi.query.api.execution.query.output.stream.OutputStream#getId() . 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: OutputParser.java    From siddhi with Apache License 2.0 6 votes vote down vote up
public static OutputCallback constructOutputCallback(OutputStream outStream, String key,
                                                     ConcurrentMap<String, StreamJunction> streamJunctionMap,
                                                     StreamDefinition outputStreamDefinition,
                                                     SiddhiQueryContext siddhiQueryContext) {
    String id = outStream.getId();
    //Construct CallBack
    if (outStream instanceof InsertIntoStream) {
        StreamJunction outputStreamJunction = streamJunctionMap.get(id + key);
        if (outputStreamJunction == null) {
            outputStreamJunction = new StreamJunction(outputStreamDefinition,
                    siddhiQueryContext.getSiddhiAppContext().getExecutorService(),
                    siddhiQueryContext.getSiddhiAppContext().getBufferSize(), null,
                    siddhiQueryContext.getSiddhiAppContext());
            streamJunctionMap.putIfAbsent(id + key, outputStreamJunction);
        }
        InsertIntoStreamCallback insertIntoStreamCallback = new InsertIntoStreamCallback(outputStreamDefinition,
                siddhiQueryContext.getName());
        insertIntoStreamCallback.init(streamJunctionMap.get(id + key));
        return insertIntoStreamCallback;

    } else {
        throw new SiddhiAppCreationException(outStream.getClass().getName() + " not supported",
                outStream.getQueryContextStartIndex(), outStream.getQueryContextEndIndex());
    }
}
 
Example 2
Source File: OnDemandQueryParser.java    From siddhi with Apache License 2.0 6 votes vote down vote up
private static OnDemandQueryRuntime getOnDemandQueryRuntime(OnDemandQuery onDemandQuery,
                                                            Map<String, Table> tableMap,
                                                            Map<String, Window> windowMap,
                                                            int metaPosition, LockWrapper lockWrapper,
                                                            MetaStreamEvent metaStreamEvent,
                                                            OutputStream outputStream, Expression onCondition,
                                                            SiddhiQueryContext siddhiQueryContext) {
    try {
        List<VariableExpressionExecutor> variableExpressionExecutors = new ArrayList<>();
        Table table = tableMap.get(outputStream.getId());

        if (table != null) {
            return constructOnDemandQueryRuntime(table, onDemandQuery, tableMap, windowMap,
                    metaPosition, onCondition, metaStreamEvent,
                    variableExpressionExecutors, lockWrapper, siddhiQueryContext);
        } else {
            throw new OnDemandQueryCreationException(outputStream.getId() + " is not a table.");
        }

    } finally {
        SnapshotService.getSkipStateStorageThreadLocal().set(null);
    }
}