Class KafkaIngester

java.lang.Object
io.deephaven.kafka.ingest.KafkaIngester

@InternalUseOnly public class KafkaIngester extends Object
An ingester that consumes an Apache Kafka topic and a subset of its partitions via one or more stream consumers.

This class is an internal implementation detail for io.deephaven.kafka; is not intended to be used directly by client code. It lives in a separate package as a means of code organization.

  • Field Details

  • Constructor Details

    • KafkaIngester

      public KafkaIngester(@NotNull @NotNull Logger log, @NotNull @NotNull Properties props, @NotNull @NotNull String topic, @NotNull @NotNull IntPredicate partitionFilter, @NotNull @NotNull Function<org.apache.kafka.common.TopicPartition,KafkaRecordConsumer> partitionToStreamConsumer, @NotNull @NotNull KafkaTools.InitialOffsetLookup partitionToInitialSeekOffset, @NotNull @NotNull org.apache.kafka.common.serialization.Deserializer<?> keyDeserializer, @NotNull @NotNull org.apache.kafka.common.serialization.Deserializer<?> valueDeserializer, @Nullable @Nullable KafkaTools.ConsumerLoopCallback consumerLoopCallback)
      Creates a Kafka ingester for the given topic.
      Parameters:
      log - A log for output
      props - The properties used to create the KafkaConsumer
      topic - The topic to replicate
      partitionFilter - A predicate indicating which partitions we should replicate
      partitionToStreamConsumer - A function implementing a mapping from partition to its consumer of records. The function will be invoked once per partition at construction; implementations should internally defer resource allocation until first call to KafkaRecordConsumer.consume(long, List) or StreamFailureConsumer.acceptFailure(Throwable) if appropriate.
      partitionToInitialSeekOffset - A function implementing a mapping from partition to its initial seek offset, or -1 if seek to beginning is intended.
      keyDeserializer - , the key deserializer, see KafkaConsumer(Properties, Deserializer, Deserializer)
      valueDeserializer - , the value deserializer, see KafkaConsumer(Properties, Deserializer, Deserializer)
      consumerLoopCallback - the consumer loop callback
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • start

      public void start()
      Starts a consumer thread which replicates the consumed Kafka messages to Deephaven.

      This method must not be called more than once on an ingester instance.

    • shutdown

      public void shutdown()
    • shutdownPartition

      public void shutdownPartition(int partition)