Class TaskSyncEventListener
java.lang.Object
io.debezium.connector.spanner.kafka.internal.TaskSyncEventListener
Consumes messages from the Sync Topic
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longprivate final Durationprivate final SyncEventConsumerFactory<String,byte[]> private final Stringprivate final Consumer<RuntimeException>private final List<BlockingBiConsumer<TaskSyncEvent,SyncEventMetadata>> private static final org.slf4j.Loggerprivate final Durationprivate final booleanprivate Threadprivate final String -
Constructor Summary
ConstructorsConstructorDescriptionTaskSyncEventListener(String consumerGroup, String topic, SyncEventConsumerFactory<String, byte[]> consumerFactory, boolean seekBackToPreviousEpoch, Consumer<RuntimeException> errorHandler) -
Method Summary
Modifier and TypeMethodDescriptionprivate TaskSyncEventparseSyncEvent(org.apache.kafka.clients.consumer.ConsumerRecord<String, byte[]> record) private intprivate voidseekBackToPreviousEpoch(org.apache.kafka.clients.consumer.Consumer<String, byte[]> consumer, org.apache.kafka.common.TopicPartition topicPartition, long beginOffset) voidshutdown()private voidshutdownConsumer(org.apache.kafka.clients.consumer.Consumer<String, byte[]> consumer) voidstart()voidsubscribe(BlockingBiConsumer<TaskSyncEvent, SyncEventMetadata> eventConsumer) voidunsubscribe(BiConsumer<TaskSyncEvent, SyncEventMetadata> eventConsumer)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
consumerGroup
-
topic
-
seekBackToPreviousEpoch
private final boolean seekBackToPreviousEpoch -
pollDuration
-
commitOffsetsTimeout
-
commitOffsetsInterval
private final long commitOffsetsInterval -
consumerFactory
-
eventConsumers
-
errorHandler
-
thread
-
-
Constructor Details
-
TaskSyncEventListener
public TaskSyncEventListener(String consumerGroup, String topic, SyncEventConsumerFactory<String, byte[]> consumerFactory, boolean seekBackToPreviousEpoch, Consumer<RuntimeException> errorHandler)
-
-
Method Details
-
subscribe
-
unsubscribe
-
start
- 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.InvalidProtocolBufferExceptionInterruptedException
-
seekBackToPreviousEpoch
private void seekBackToPreviousEpoch(org.apache.kafka.clients.consumer.Consumer<String, byte[]> consumer, org.apache.kafka.common.TopicPartition topicPartition, long beginOffset) 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
-
shutdown
public void shutdown()
-