private static StreamDefinition createFaultStreamDefinition(StreamDefinition streamDefinition) {

        List<Attribute> attributeList = streamDefinition.getAttributeList();
        StreamDefinition faultStreamDefinition = new StreamDefinition();
        faultStreamDefinition.setId(SiddhiConstants.FAULT_STREAM_PREFIX.concat(streamDefinition.getId()));
        for (Attribute attribute : attributeList) {
            faultStreamDefinition.attribute(attribute.getName(), attribute.getType());
        }
        faultStreamDefinition.attribute("_error", Attribute.Type.OBJECT);

        faultStreamDefinition.setQueryContextStartIndex(streamDefinition.getQueryContextStartIndex());
        faultStreamDefinition.setQueryContextEndIndex(streamDefinition.getQueryContextEndIndex());
        return faultStreamDefinition;
    }
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