Class SiddhiManager


  • public class SiddhiManager
    extends Object
    This is the main interface class of Siddhi where users will interact when using Siddhi as a library.
    • Constructor Detail

      • SiddhiManager

        public SiddhiManager()
        Creates a Siddhi Manager instance with default SiddhiContext. This is the only method to create a new Siddhi Manager instance which is the main interface when you use Siddhi as a library.
    • Method Detail

      • getAttributes

        public Map<String,​Object> getAttributes()
        Attributes that are common across all the Siddhi Apps
        Returns:
        Attribute Map<String, Object>
      • setAttribute

        public void setAttribute​(String key,
                                 Object value)
        Set Attributes which can be retried by all the Siddhi Elements/Extensions via the SiddhiAppContext
      • createSiddhiAppRuntime

        public SiddhiAppRuntime createSiddhiAppRuntime​(io.siddhi.query.api.SiddhiApp siddhiApp)
      • createSandboxSiddhiAppRuntime

        public SiddhiAppRuntime createSandboxSiddhiAppRuntime​(String siddhiApp)
        Create a SiddhiApp Sandbox Runtime that runs without their Sources Sinks and Stores.
        Parameters:
        siddhiApp - SiddhiApp
        Returns:
        SiddhiAppRuntime without its Sources Sinks and Stores.
      • createSandboxSiddhiAppRuntime

        public SiddhiAppRuntime createSandboxSiddhiAppRuntime​(io.siddhi.query.api.SiddhiApp siddhiApp)
        Create a SiddhiApp Sandbox Runtime that runs without their Sources Sinks and Stores.
        Parameters:
        siddhiApp - SiddhiApp
        Returns:
        SiddhiAppRuntime without its Sources Sinks and Stores.
      • getSiddhiAppRuntime

        public SiddhiAppRuntime getSiddhiAppRuntime​(String siddhiAppName)
        Method to retrieve already submitted siddhi app by providing the name.
        Parameters:
        siddhiAppName - Name of the required Siddhi app
        Returns:
        Siddhi app Runtime representing the provided name
      • validateSiddhiApp

        public void validateSiddhiApp​(io.siddhi.query.api.SiddhiApp siddhiApp)
      • validateSiddhiApp

        public void validateSiddhiApp​(String siddhiApp)
      • setPersistenceStore

        public void setPersistenceStore​(PersistenceStore persistenceStore)
        Method to set persistence for the Siddhi Manager instance. InMemoryPersistenceStore is the default persistence store implementation users can utilize.
        Parameters:
        persistenceStore - Persistence Store implementation to be used.
      • setErrorStore

        public void setErrorStore​(ErrorStore errorStore)
        Method to set error store for the Siddhi Manager instance.
        Parameters:
        errorStore - Error store implementation to be used.
      • setSinkHandlerManager

        public void setSinkHandlerManager​(SinkHandlerManager sinkHandlerManager)
        Method to set sink handler manager that would create sink handlers for each sink
        Parameters:
        sinkHandlerManager - Sink Handler Manager Implementation to be used.
      • setSourceHandlerManager

        public void setSourceHandlerManager​(SourceHandlerManager sourceHandlerManager)
        Method to set source handler manager that would create source handlers for each source
        Parameters:
        sourceHandlerManager - Source Handler Manager Implementation to be used.
      • setRecordTableHandlerManager

        public void setRecordTableHandlerManager​(RecordTableHandlerManager recordTableHandlerManager)
        Method to set record table handler manager that would create record table handlers for each record table
        Parameters:
        recordTableHandlerManager - Record Table Handler Manager Implementation to be used.
      • setConfigManager

        public void setConfigManager​(ConfigManager configManager)
        Method to set configManager for the Siddhi Manager instance.
        Parameters:
        configManager - Config Manager implementation to be used.
      • setExtension

        public void setExtension​(String name,
                                 Class clazz)
        Method used to register extensions to the Siddhi Manager. But extension classes should be present in classpath.
        Parameters:
        name - Name of the extension as mentioned in the annotation.
        clazz - Class name of the implementation
      • getExtensions

        public Map<String,​Class> getExtensions()
        Method used to get the extensions registered in the siddhi manager.
        Returns:
        Extension name to class map
      • removeExtension

        public void removeExtension​(String name)
        Method used to remove the extensions registered in the siddhi manager.
        Parameters:
        name - Name of the extension as given in the annotation.
      • setDataSource

        public void setDataSource​(String dataSourceName,
                                  DataSource dataSource)
        Method used to add Carbon DataSources to Siddhi Manager to utilize them for event tables.
        Parameters:
        dataSourceName - Name of the DataSource
        dataSource - Object representing DataSource
      • setStatisticsConfiguration

        public void setStatisticsConfiguration​(StatisticsConfiguration statisticsConfiguration)
        Method to integrate Carbon Metrics into Siddhi
        Parameters:
        statisticsConfiguration - statistics configuration
      • shutdown

        public void shutdown()
        Method to shutdown Siddhi Manager
      • persist

        public void persist()
        Method used persist state of current Siddhi Manager instance. This will internally call all SiddhiAppRuntimes within Siddhi Manager.
      • restoreLastState

        public void restoreLastState()
        Method used to restore state of Current Siddhi Manager instance. This will internally call all SiddhiAppRuntimes within Siddhi Manager.
      • getLastRevision

        public String getLastRevision​(String siddhiAppName)
        Method to retrieve last revision for siddhi app by providing the name.
        Parameters:
        siddhiAppName - Name of the required Siddhi app
        Returns:
        revision
      • setIncrementalPersistenceStore

        public void setIncrementalPersistenceStore​(IncrementalPersistenceStore incrementalPersistenceStore)