private static List<String> getFindExecutedElements(SiddhiApp siddhiApp) {
        List<String> findExecutedElements = new ArrayList<>();
        for (ExecutionElement executionElement : siddhiApp.getExecutionElementList()) {
            if (executionElement instanceof Query) {
                List<StreamHandler> streamHandlers = new ArrayList<>();
                if (((Query) executionElement).getInputStream() instanceof JoinInputStream) {
                    findExecutedElements.addAll(((Query) executionElement).getInputStream().getAllStreamIds());
                    streamHandlers.addAll(((SingleInputStream) ((JoinInputStream) ((Query) executionElement).getInputStream()).getLeftInputStream()).getStreamHandlers());
                    streamHandlers.addAll(((SingleInputStream) ((JoinInputStream) ((Query) executionElement).getInputStream()).getRightInputStream()).getStreamHandlers());
                } else if (((Query) executionElement).getInputStream() instanceof SingleInputStream) {
                    streamHandlers.addAll(((SingleInputStream) ((Query) executionElement).getInputStream()).getStreamHandlers());
                } else if (((Query) executionElement).getInputStream() instanceof StateInputStream) {
                    streamHandlers.addAll((((StateInputStream) ((Query) executionElement).getInputStream()).getStreamHandlers()));
                }
                for (StreamHandler streamHandler : streamHandlers) {
                    if (streamHandler instanceof In) {
                        findExecutedElements.add(((In) streamHandler).getSourceId());
                    }
                }
            } else {
                List<Query> queries = ((Partition) executionElement).getQueryList();
                for (Query query : queries) {
                    List<StreamHandler> streamHandlers = new ArrayList<>();
                    if (query.getInputStream() instanceof JoinInputStream) {
                        findExecutedElements.addAll(query.getInputStream().getAllStreamIds());
                        streamHandlers.addAll(((SingleInputStream) ((JoinInputStream) query.getInputStream()).getLeftInputStream()).getStreamHandlers());
                        streamHandlers.addAll(((SingleInputStream) ((JoinInputStream) query.getInputStream()).getRightInputStream()).getStreamHandlers());
                    } else if (query.getInputStream() instanceof SingleInputStream) {
                        streamHandlers.addAll(((SingleInputStream) query.getInputStream()).getStreamHandlers());
                    } else if (query.getInputStream() instanceof StateInputStream) {
                        streamHandlers.addAll((((StateInputStream) query.getInputStream()).getStreamHandlers()));
                    }
                    for (StreamHandler streamHandler : streamHandlers) {
                        if (streamHandler instanceof In) {
                            findExecutedElements.add(((In) streamHandler).getSourceId());
                        }
                    }
                }
            }

        }
        return findExecutedElements;
    }
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