public PersistenceReference persist() {
        try {
            // first, pause all the event sources
            sourceMap.values().forEach(list -> list.forEach(Source::pause));
            // take snapshots of execution units
            if (siddhiAppContext.getSiddhiContext().getPersistenceStore() != null) {
                return PersistenceHelper.persist(siddhiAppContext.getSnapshotService().fullSnapshot(),
                        siddhiAppContext);
            } else {
                return PersistenceHelper.persist(siddhiAppContext.getSnapshotService().incrementalSnapshot(),
                        siddhiAppContext);
            }
        } finally {
            // at the end, resume the event sources
            sourceMap.values().forEach(list -> list.forEach(Source::resume));
        }
    }
This method get the onDemandQuery and return the corresponding output and its types.

@param onDemandQuery       this onDemandQuery is processed and get the output attributes.
@param onDemandQueryString this passed to report errors with context if there are any.
@return List of output attributes
modules/siddhi-core/src/main/java/io/siddhi/core/SiddhiAppRuntimeImpl.java