private static void defineStreamDefinitions(SiddhiAppRuntimeBuilder siddhiAppRuntimeBuilder,
                                                Map<String, StreamDefinition> streamDefinitionMap,
                                                SiddhiAppContext siddhiAppContext) {
        for (StreamDefinition definition : streamDefinitionMap.values()) {
            try {
                Annotation onErrorAnnotation = AnnotationHelper.getAnnotation(SiddhiConstants.ANNOTATION_ON_ERROR,
                        definition.getAnnotations());
                if (onErrorAnnotation != null) {
                    StreamJunction.OnErrorAction onErrorAction = StreamJunction.OnErrorAction.valueOf(onErrorAnnotation
                            .getElement(SiddhiConstants.ANNOTATION_ELEMENT_ACTION).toUpperCase());
                    if (onErrorAction == StreamJunction.OnErrorAction.STREAM) {
                        StreamDefinition faultStreamDefinition = createFaultStreamDefinition(definition);
                        siddhiAppRuntimeBuilder.defineStream(faultStreamDefinition);
                    }
                }
                siddhiAppRuntimeBuilder.defineStream(definition);
            } catch (Throwable t) {
                ExceptionUtil.populateQueryContext(t, definition, siddhiAppContext);
                throw t;
            }
        }
    }
Parse an SiddhiApp returning SiddhiAppRuntime

@param siddhiApp       plan to be parsed
@param siddhiAppString content of Siddhi application as string
@param siddhiContext   SiddhiContext  @return SiddhiAppRuntime
@return SiddhiAppRuntimeBuilder
modules/siddhi-core/src/main/java/io/siddhi/core/util/parser/SiddhiAppParser.java