Class InMemorySink
- java.lang.Object
-
- io.siddhi.core.stream.output.sink.Sink<State>
-
- io.siddhi.core.stream.output.sink.InMemorySink
-
- All Implemented Interfaces:
SinkListener
public class InMemorySink extends Sink<State>
Implementation ofSinkwhich represents in-memory transport. This implementation can send incoming objects to in-memory transport within JVM.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.siddhi.core.stream.output.sink.Sink
Sink.OnErrorAction
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringTOPIC_KEYprotected OptiontopicOption-
Fields inherited from class io.siddhi.core.stream.output.sink.Sink
isTryingToConnect
-
-
Constructor Summary
Constructors Constructor Description InMemorySink()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect()Called to connect to the backend before events are publishedvoiddestroy()Called at the end to clean all the resources consumedvoiddisconnect()Called after all publishing is done, or when ConnectionUnavailableException is thrownprotected ServiceDeploymentInfoexposeServiceDeploymentInfo()Give information to the deployment about the service exposed by the sink.String[]getSupportedDynamicOptions()Supported dynamic options by the transportClass[]getSupportedInputEventClasses()protected StateFactory<State>init(io.siddhi.query.api.definition.StreamDefinition outputStreamDefinition, OptionHolder optionHolder, ConfigReader sinkConfigReader, SiddhiAppContext siddhiAppContext)Will be called for initialing theSinkvoidpublish(Object payload, DynamicOptions dynamicOptions, State s)Sending events via output transport-
Methods inherited from class io.siddhi.core.stream.output.sink.Sink
connectWithRetry, getHandler, getMapper, getServiceDeploymentInfoList, getStreamDefinition, getType, init, initOnlyTransport, isConnected, isStateful, onError, publish, retryPublish, setConnected, shutdown
-
-
-
-
Field Detail
-
TOPIC_KEY
protected static final String TOPIC_KEY
- See Also:
- Constant Field Values
-
topicOption
protected Option topicOption
-
-
Method Detail
-
getSupportedInputEventClasses
public Class[] getSupportedInputEventClasses()
- Specified by:
getSupportedInputEventClassesin classSink<State>
-
exposeServiceDeploymentInfo
protected ServiceDeploymentInfo exposeServiceDeploymentInfo()
Description copied from class:SinkGive information to the deployment about the service exposed by the sink.- Specified by:
exposeServiceDeploymentInfoin classSink<State>- Returns:
- ServiceDeploymentInfo Service related information to the deployment
-
getSupportedDynamicOptions
public String[] getSupportedDynamicOptions()
Description copied from class:SinkSupported dynamic options by the transport- Specified by:
getSupportedDynamicOptionsin classSink<State>- Returns:
- the list of supported dynamic option keys
-
init
protected StateFactory<State> init(io.siddhi.query.api.definition.StreamDefinition outputStreamDefinition, OptionHolder optionHolder, ConfigReader sinkConfigReader, SiddhiAppContext siddhiAppContext)
Description copied from class:SinkWill be called for initialing theSink- Specified by:
initin classSink<State>- Parameters:
outputStreamDefinition- containing stream definition bind to theSinkoptionHolder- Option holder containing static and dynamic options related to theSinksinkConfigReader- this hold theSinkextensions configuration reader.siddhiAppContext-SiddhiAppContextof the parent siddhi app.
-
connect
public void connect() throws ConnectionUnavailableExceptionDescription copied from class:SinkCalled to connect to the backend before events are published- Specified by:
connectin classSink<State>- Throws:
ConnectionUnavailableException- if it cannot connect to the backend
-
disconnect
public void disconnect()
Description copied from class:SinkCalled after all publishing is done, or when ConnectionUnavailableException is thrown- Specified by:
disconnectin classSink<State>
-
destroy
public void destroy()
Description copied from class:SinkCalled at the end to clean all the resources consumed
-
publish
public void publish(Object payload, DynamicOptions dynamicOptions, State s) throws ConnectionUnavailableException
Description copied from class:SinkSending events via output transport- Specified by:
publishin classSink<State>- Parameters:
payload- payload of the eventdynamicOptions- of the event constructing the payloads- current state of the sink- Throws:
ConnectionUnavailableException- throw when connections are unavailable.
-
-