Interface SinkContext

All Superinterfaces:
org.apache.pulsar.functions.api.BaseContext

@Public @Stable public interface SinkContext extends org.apache.pulsar.functions.api.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 Type
    Method
    Description
    Get a list of all input topics.
    org.apache.pulsar.common.io.SinkConfig
    Get sink config at startup.
    The name of the sink that we are executing.
    default org.apache.pulsar.client.api.SubscriptionType
    Get subscription type used by the source providing data for the sink.
    default void
    pause(String topic, int partition)
    Stop requesting new messages for given topic and partition until resume(String topic, int partition) is called.
    default void
    resume(String topic, int partition)
    Resume requesting messages.
    default void
    seek(String topic, int partition, org.apache.pulsar.client.api.MessageId messageId)
    Reset 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 name
      partition - - 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 until resume(String topic, int partition) is called.
      Parameters:
      topic - - topic name
      partition - - 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 name
      partition - - partition id (0 for non-partitioned topics)
      Throws:
      org.apache.pulsar.client.api.PulsarClientException