Class LeaderService
java.lang.Object
io.debezium.connector.spanner.task.leader.LeaderService
Provides a Leader Task functionality, after the rebalance event happens.
Leader waits all the task answer to rebalance event, distributes partitions across
tasks, generates New Epoch message.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Durationprivate final com.google.cloud.Timestampprivate final io.debezium.pipeline.ErrorHandlerprivate final io.debezium.function.BlockingConsumer<TaskStateChangeEvent>private static final org.slf4j.Loggerprivate final MetricsEventPublisherprivate final PartitionFactoryprivate static final intprivate final com.google.cloud.Timestampprivate final TaskSyncContextHolder -
Constructor Summary
ConstructorsConstructorDescriptionLeaderService(TaskSyncContextHolder taskSyncContextHolder, SpannerConnectorConfig spannerConnectorConfig, io.debezium.function.BlockingConsumer<TaskStateChangeEvent> eventConsumer, io.debezium.pipeline.ErrorHandler errorHandler, PartitionFactory partitionFactory, MetricsEventPublisher metricsEventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionawaitAllNewTaskStateUpdates(Set<String> consumers, long rebalanceGenerationId) booleanvoid
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
POLL_INTERVAL_MILLIS
private static final int POLL_INTERVAL_MILLIS- See Also:
-
AWAIT_TASK_ANSWER_DURATION
-
taskSyncContextHolder
-
startTime
private final com.google.cloud.Timestamp startTime -
endTime
private final com.google.cloud.Timestamp endTime -
eventConsumer
-
errorHandler
private final io.debezium.pipeline.ErrorHandler errorHandler -
metricsEventPublisher
-
partitionFactory
-
-
Constructor Details
-
LeaderService
public LeaderService(TaskSyncContextHolder taskSyncContextHolder, SpannerConnectorConfig spannerConnectorConfig, io.debezium.function.BlockingConsumer<TaskStateChangeEvent> eventConsumer, io.debezium.pipeline.ErrorHandler errorHandler, PartitionFactory partitionFactory, MetricsEventPublisher metricsEventPublisher)
-
-
Method Details
-
isStartFromScratch
public boolean isStartFromScratch() -
awaitAllNewTaskStateUpdates
public Map<String,String> awaitAllNewTaskStateUpdates(Set<String> consumers, long rebalanceGenerationId) throws InterruptedException - Throws:
InterruptedException
-
newParentPartition
- Throws:
InterruptedException
-