Package io.siddhi.core.util.transport
Class SingleClientDistributedSink
- java.lang.Object
-
- io.siddhi.core.stream.output.sink.Sink
-
- io.siddhi.core.stream.output.sink.distributed.DistributedTransport
-
- io.siddhi.core.util.transport.SingleClientDistributedSink
-
- All Implemented Interfaces:
SinkListener
public class SingleClientDistributedSink extends DistributedTransport
This class implements a the distributed sink that could publish to multiple destination using a single client/publisher. Following are some examples, - In a case where there are multiple partitions in a single topic in Kafka, the same kafka client can be used to send events to all the partitions within the topic. - The same email client can send email to different addresses.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classSingleClientDistributedSink.SingleClientConnectionCallbackConnection callback to notify DistributionStrategy about new connection initiations and failures-
Nested classes/interfaces inherited from class io.siddhi.core.stream.output.sink.distributed.DistributedTransport
DistributedTransport.ConnectionCallback
-
Nested classes/interfaces inherited from class io.siddhi.core.stream.output.sink.Sink
Sink.OnErrorAction
-
-
Field Summary
-
Fields inherited from class io.siddhi.core.stream.output.sink.distributed.DistributedTransport
siddhiAppContext, strategy, streamDefinition
-
Fields inherited from class io.siddhi.core.stream.output.sink.Sink
isTryingToConnect
-
-
Constructor Summary
Constructors Constructor Description SingleClientDistributedSink()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect()Will be called to connect to the backend before events are publishedvoiddestroy()Will be called at the end to clean all the resources consumedvoiddisconnect()Will be called after all publishing is done, or when ConnectionUnavailableException is thrownprotected ServiceDeploymentInfoexposeServiceDeploymentInfo()Give information to the deployment about the service exposed by the sink.List<ServiceDeploymentInfo>getServiceDeploymentInfoList()Class[]getSupportedInputEventClasses()voidinitTransport(OptionHolder sinkOptionHolder, List<OptionHolder> destinationOptionHolders, Map<String,String> deploymentProperties, List<Map<String,String>> destinationDeploymentProperties, io.siddhi.query.api.annotation.Annotation sinkAnnotation, ConfigReader sinkConfigReader, DistributionStrategy strategy, String type, SiddhiAppContext siddhiAppContext)voidpublish(Object payload, DynamicOptions transportOptions, Integer destinationId, State s)-
Methods inherited from class io.siddhi.core.stream.output.sink.distributed.DistributedTransport
getSupportedDynamicOptions, init, init, isConnected, publish
-
Methods inherited from class io.siddhi.core.stream.output.sink.Sink
connectWithRetry, getHandler, getMapper, getStreamDefinition, getType, init, initOnlyTransport, isStateful, onError, publish, retryPublish, setConnected, shutdown
-
-
-
-
Method Detail
-
publish
public void publish(Object payload, DynamicOptions transportOptions, Integer destinationId, State s) throws ConnectionUnavailableException
- Specified by:
publishin classDistributedTransport- Throws:
ConnectionUnavailableException
-
initTransport
public void initTransport(OptionHolder sinkOptionHolder, List<OptionHolder> destinationOptionHolders, Map<String,String> deploymentProperties, List<Map<String,String>> destinationDeploymentProperties, io.siddhi.query.api.annotation.Annotation sinkAnnotation, ConfigReader sinkConfigReader, DistributionStrategy strategy, String type, SiddhiAppContext siddhiAppContext)
- Specified by:
initTransportin classDistributedTransport
-
getSupportedInputEventClasses
public Class[] getSupportedInputEventClasses()
- Specified by:
getSupportedInputEventClassesin classSink
-
connect
public void connect() throws ConnectionUnavailableExceptionWill be called to connect to the backend before events are published- Specified by:
connectin classSink- Throws:
ConnectionUnavailableException- if it cannot connect to the backend
-
disconnect
public void disconnect()
Will be called after all publishing is done, or when ConnectionUnavailableException is thrown- Specified by:
disconnectin classSink
-
destroy
public void destroy()
Will be called at the end to clean all the resources consumed
-
exposeServiceDeploymentInfo
protected ServiceDeploymentInfo exposeServiceDeploymentInfo()
Description copied from class:SinkGive information to the deployment about the service exposed by the sink.- Specified by:
exposeServiceDeploymentInfoin classSink- Returns:
- ServiceDeploymentInfo Service related information to the deployment
-
getServiceDeploymentInfoList
public List<ServiceDeploymentInfo> getServiceDeploymentInfoList()
- Overrides:
getServiceDeploymentInfoListin classSink
-
-