Package io.debezium.pipeline
Class ChangeEventSourceCoordinator<P extends Partition,O extends OffsetContext>
- java.lang.Object
-
- io.debezium.pipeline.ChangeEventSourceCoordinator<P,O>
-
@ThreadSafe public class ChangeEventSourceCoordinator<P extends Partition,O extends OffsetContext> extends Object
Coordinates one or moreChangeEventSources and executes them in order.- Author:
- Gunnar Morling
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classChangeEventSourceCoordinator.CatchUpStreamingResultprivate classChangeEventSourceCoordinator.ChangeEventSourceContextImpl
-
Field Summary
Fields Modifier and Type Field Description private ChangeEventSourceFactory<P,O>changeEventSourceFactoryprivate ChangeEventSourceMetricsFactorychangeEventSourceMetricsFactoryprivate ReentrantLockcommitOffsetLockprivate ErrorHandlererrorHandlerprivate EventDispatcher<?>eventDispatcherprivate ExecutorServiceexecutorprivate static org.slf4j.LoggerLOGGERprivate Offsets<P,O>previousOffsetsprivate booleanrunningprivate DatabaseSchema<?>schemastatic DurationSHUTDOWN_WAIT_TIMEOUTWaiting period for the polling loop to finish.private SnapshotChangeEventSourceMetricssnapshotMetricsprivate StreamingChangeEventSourceMetricsstreamingMetricsprivate StreamingChangeEventSource<P,O>streamingSource
-
Constructor Summary
Constructors Constructor Description ChangeEventSourceCoordinator(Offsets<P,O> previousOffsets, ErrorHandler errorHandler, Class<? extends org.apache.kafka.connect.source.SourceConnector> connectorType, CommonConnectorConfig connectorConfig, ChangeEventSourceFactory<P,O> changeEventSourceFactory, ChangeEventSourceMetricsFactory changeEventSourceMetricsFactory, EventDispatcher<?> eventDispatcher, DatabaseSchema<?> schema)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommitOffset(Map<String,?> offset)protected ChangeEventSourceCoordinator.CatchUpStreamingResultexecuteCatchUpStreaming(ChangeEventSource.ChangeEventSourceContext context, SnapshotChangeEventSource<P,O> snapshotSource, P partition, O previousOffset)voidstart(CdcSourceTaskContext taskContext, ChangeEventQueueMetrics changeEventQueueMetrics, EventMetadataProvider metadataProvider)voidstop()Stops this coordinator.protected voidstreamEvents(ChangeEventSource.ChangeEventSourceContext context, P partition, O offsetContext)private voidstreamingConnected(boolean status)
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
SHUTDOWN_WAIT_TIMEOUT
public static final Duration SHUTDOWN_WAIT_TIMEOUT
Waiting period for the polling loop to finish. Will be applied twice, once gracefully, once forcefully.
-
previousOffsets
private final Offsets<P extends Partition,O extends OffsetContext> previousOffsets
-
errorHandler
private final ErrorHandler errorHandler
-
changeEventSourceFactory
private final ChangeEventSourceFactory<P extends Partition,O extends OffsetContext> changeEventSourceFactory
-
changeEventSourceMetricsFactory
private final ChangeEventSourceMetricsFactory changeEventSourceMetricsFactory
-
executor
private final ExecutorService executor
-
eventDispatcher
private final EventDispatcher<?> eventDispatcher
-
schema
private final DatabaseSchema<?> schema
-
running
private volatile boolean running
-
streamingSource
private volatile StreamingChangeEventSource<P extends Partition,O extends OffsetContext> streamingSource
-
commitOffsetLock
private final ReentrantLock commitOffsetLock
-
snapshotMetrics
private SnapshotChangeEventSourceMetrics snapshotMetrics
-
streamingMetrics
private StreamingChangeEventSourceMetrics streamingMetrics
-
-
Constructor Detail
-
ChangeEventSourceCoordinator
public ChangeEventSourceCoordinator(Offsets<P,O> previousOffsets, ErrorHandler errorHandler, Class<? extends org.apache.kafka.connect.source.SourceConnector> connectorType, CommonConnectorConfig connectorConfig, ChangeEventSourceFactory<P,O> changeEventSourceFactory, ChangeEventSourceMetricsFactory changeEventSourceMetricsFactory, EventDispatcher<?> eventDispatcher, DatabaseSchema<?> schema)
-
-
Method Detail
-
start
public void start(CdcSourceTaskContext taskContext, ChangeEventQueueMetrics changeEventQueueMetrics, EventMetadataProvider metadataProvider)
-
executeCatchUpStreaming
protected ChangeEventSourceCoordinator.CatchUpStreamingResult executeCatchUpStreaming(ChangeEventSource.ChangeEventSourceContext context, SnapshotChangeEventSource<P,O> snapshotSource, P partition, O previousOffset) throws InterruptedException
- Throws:
InterruptedException
-
streamEvents
protected void streamEvents(ChangeEventSource.ChangeEventSourceContext context, P partition, O offsetContext) throws InterruptedException
- Throws:
InterruptedException
-
stop
public void stop() throws InterruptedExceptionStops this coordinator.- Throws:
InterruptedException
-
streamingConnected
private void streamingConnected(boolean status)
-
-