use of io.siddhi.core.stream.StreamJunction in project siddhi by wso2.
the class OutputParser method constructOutputCallback.
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());
}
}
use of io.siddhi.core.stream.StreamJunction in project siddhi by wso2.
the class DefinitionParserHelper method addStreamJunction.
public static void addStreamJunction(StreamDefinition streamDefinition, ConcurrentMap<String, StreamJunction> streamJunctionMap, SiddhiAppContext siddhiAppContext) {
if (!streamJunctionMap.containsKey(streamDefinition.getId())) {
StreamJunction faultStreamJunction = streamJunctionMap.get(SiddhiConstants.FAULT_STREAM_PREFIX.concat(streamDefinition.getId()));
StreamJunction streamJunction = new StreamJunction(streamDefinition, siddhiAppContext.getExecutorService(), siddhiAppContext.getBufferSize(), faultStreamJunction, siddhiAppContext);
streamJunctionMap.putIfAbsent(streamDefinition.getId(), streamJunction);
}
}
Aggregations