Package org.apache.pulsar.io.core
Interface SinkContext
- All Superinterfaces:
BaseContext
Interface for a sink connector providing information about environment where it is running.
It also allows to propagate information, such as logs, metrics, states, back to the Pulsar environment.
-
Method Summary
Modifier and TypeMethodDescriptionGet a list of all input topics.org.apache.pulsar.common.io.SinkConfigGet sink config at startup.The name of the sink that we are executing.default org.apache.pulsar.client.api.SubscriptionTypeGet subscription type used by the source providing data for the sink.default voidStop requesting new messages for given topic and partition untilresume(String topic, int partition)is called.default voidResume requesting messages.default voidReset the subscription associated with this topic and partition to a specific message id.Methods inherited from interface org.apache.pulsar.functions.api.BaseContext
deleteState, deleteStateAsync, getCounter, getCounterAsync, getInstanceId, getLogger, getNamespace, getNumInstances, getPulsarClient, getPulsarClientBuilder, getSecret, getState, getStateAsync, getStateStore, getStateStore, getTenant, incrCounter, incrCounterAsync, putState, putStateAsync, recordMetric
-
Method Details
-
getSinkName
String getSinkName()The name of the sink that we are executing.- Returns:
- The Sink name
-
getInputTopics
Collection<String> getInputTopics()Get a list of all input topics.- Returns:
- a list of all input topics
-
getSinkConfig
org.apache.pulsar.common.io.SinkConfig getSinkConfig()Get sink config at startup.- Returns:
- sink config
-
getSubscriptionType
default org.apache.pulsar.client.api.SubscriptionType getSubscriptionType()Get subscription type used by the source providing data for the sink.- Returns:
- subscription type
-
seek
default void seek(String topic, int partition, org.apache.pulsar.client.api.MessageId messageId) throws org.apache.pulsar.client.api.PulsarClientException Reset the subscription associated with this topic and partition to a specific message id.- Parameters:
topic- - topic namepartition- - partition id (0 for non-partitioned topics)messageId- to reset to- Throws:
org.apache.pulsar.client.api.PulsarClientException
-
pause
default void pause(String topic, int partition) throws org.apache.pulsar.client.api.PulsarClientException Stop requesting new messages for given topic and partition untilresume(String topic, int partition)is called.- Parameters:
topic- - topic namepartition- - partition id (0 for non-partitioned topics)- Throws:
org.apache.pulsar.client.api.PulsarClientException
-
resume
default void resume(String topic, int partition) throws org.apache.pulsar.client.api.PulsarClientException Resume requesting messages.- Parameters:
topic- - topic namepartition- - partition id (0 for non-partitioned topics)- Throws:
org.apache.pulsar.client.api.PulsarClientException
-