Interface SourceContext

All Superinterfaces:
BaseContext

@Public @Stable public interface SourceContext extends BaseContext
Interface for a source 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 Details

    • getSourceName

      String getSourceName()
      The name of the source that we are executing.
      Returns:
      The Source name
    • getOutputTopic

      String getOutputTopic()
      Get the output topic of the source.
      Returns:
      output topic name
    • getSourceConfig

      org.apache.pulsar.common.io.SourceConfig getSourceConfig()
      Get the source config.
      Returns:
      source config
    • newOutputMessage

      <T> org.apache.pulsar.client.api.TypedMessageBuilder<T> newOutputMessage(String topicName, org.apache.pulsar.client.api.Schema<T> schema) throws org.apache.pulsar.client.api.PulsarClientException
      New output message using schema for serializing to the topic.
      Type Parameters:
      T -
      Parameters:
      topicName - The name of the topic for output message
      schema - provide a way to convert between serialized data and domain objects
      Returns:
      the message builder instance
      Throws:
      org.apache.pulsar.client.api.PulsarClientException
    • newConsumerBuilder

      <T> org.apache.pulsar.client.api.ConsumerBuilder<T> newConsumerBuilder(org.apache.pulsar.client.api.Schema<T> schema) throws org.apache.pulsar.client.api.PulsarClientException
      Create a ConsumerBuilder with the schema.
      Type Parameters:
      T -
      Parameters:
      schema - provide a way to convert between serialized data and domain objects
      Returns:
      the consumer builder instance
      Throws:
      org.apache.pulsar.client.api.PulsarClientException