Class KafkaTopicSource

All Implemented Interfaces:
Serializable, ActualOperator, ElementaryOperator, Operator
Direct Known Subclasses:
JavaKafkaTopicSource, SparkKafkaTopicSource

public class KafkaTopicSource extends UnarySource<String>
This source reads messages from a Kafka topic and outputs the messages as data units.
See Also:
  • Constructor Details

    • KafkaTopicSource

      public KafkaTopicSource(String topicName)
    • KafkaTopicSource

      public KafkaTopicSource(String topicName, String encoding)
    • KafkaTopicSource

      public KafkaTopicSource(KafkaTopicSource that)
      Copies an instance (exclusive of broadcasts).
      Parameters:
      that - that should be copied
  • Method Details

    • initConsumer

      public void initConsumer(KafkaTopicSource kts)
    • getTopicName

      public String getTopicName()
    • getEncoding

      public String getEncoding()
    • getConsumer

      public org.apache.kafka.clients.consumer.KafkaConsumer<String,String> getConsumer()
    • getConsumer

      public org.apache.kafka.clients.consumer.KafkaConsumer<String,String> getConsumer(Properties props)
    • loadConfig

      public static Properties loadConfig(String propertiesFilePath)
      Load properties from a properties file or alternatively use the default properties with some sensitive values from environment variables.
      Parameters:
      propertiesFilePath - - File path or null.
      Returns:
      Properties object
    • getDefaultProperties

      public static Properties getDefaultProperties()
    • createCardinalityEstimator

      public Optional<CardinalityEstimator> createCardinalityEstimator(int outputIndex, Configuration configuration)
      Description copied from interface: ElementaryOperator
      Provide a CardinalityEstimator for the OutputSlot at outputIndex.
      Parameters:
      outputIndex - index of the OutputSlot for that the CardinalityEstimator is requested
      configuration - if the CardinalityEstimator depends on further ones, use this to obtain the latter
      Returns:
      an Optional that might provide the requested instance
    • startConsuming

      public void startConsuming()