Class TaskSyncEventListener

java.lang.Object
io.debezium.connector.spanner.kafka.internal.TaskSyncEventListener

public class TaskSyncEventListener extends Object
Consumes messages from the Sync Topic
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • consumerGroup

      private final String consumerGroup
    • topic

      private final String topic
    • seekBackToPreviousEpoch

      private final boolean seekBackToPreviousEpoch
    • pollDuration

      private final Duration pollDuration
    • commitOffsetsTimeout

      private final Duration commitOffsetsTimeout
    • commitOffsetsInterval

      private final long commitOffsetsInterval
    • consumerFactory

      private final SyncEventConsumerFactory<String,byte[]> consumerFactory
    • eventConsumers

      private final List<BlockingBiConsumer<TaskSyncEvent,SyncEventMetadata>> eventConsumers
    • errorHandler

      private final Consumer<RuntimeException> errorHandler
    • pollInterval

      private final Duration pollInterval
    • clock

      private final io.debezium.util.Clock clock
    • thread

      private volatile Thread thread
  • Constructor Details

  • Method Details

    • subscribe

      public void subscribe(BlockingBiConsumer<TaskSyncEvent,SyncEventMetadata> eventConsumer)
    • unsubscribe

      public void unsubscribe(BiConsumer<TaskSyncEvent,SyncEventMetadata> eventConsumer)
    • start

      public void start() throws InterruptedException
      Throws:
      InterruptedException
    • poll

      private int poll(org.apache.kafka.clients.consumer.Consumer<String,byte[]> consumer, long endOffset) throws com.google.protobuf.InvalidProtocolBufferException, InterruptedException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
      InterruptedException
    • seekBackToPreviousEpoch

      private void seekBackToPreviousEpoch(org.apache.kafka.clients.consumer.Consumer<String,byte[]> consumer, org.apache.kafka.common.TopicPartition topicPartition, long beginOffset, long currOffset) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • parseSyncEvent

      private TaskSyncEvent parseSyncEvent(org.apache.kafka.clients.consumer.ConsumerRecord<String,byte[]> record) throws com.google.protobuf.InvalidProtocolBufferException
      Throws:
      com.google.protobuf.InvalidProtocolBufferException
    • shutdownConsumer

      private void shutdownConsumer(org.apache.kafka.clients.consumer.Consumer<String,byte[]> consumer)
    • shutdown

      public void shutdown()