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 moreChangeEventSource
s and executes them in order.- Author:
- Gunnar Morling
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ChangeEventSourceCoordinator.CatchUpStreamingResult
class
ChangeEventSourceCoordinator.ChangeEventSourceContextImpl
-
Field Summary
Fields Modifier and Type Field Description protected ChangeEventSourceFactory<P,O>
changeEventSourceFactory
protected ChangeEventSourceMetricsFactory
changeEventSourceMetricsFactory
protected ReentrantLock
commitOffsetLock
protected ErrorHandler
errorHandler
protected EventDispatcher<?>
eventDispatcher
protected ExecutorService
executor
private static org.slf4j.Logger
LOGGER
protected Offsets<P,O>
previousOffsets
private boolean
running
protected DatabaseSchema<?>
schema
static Duration
SHUTDOWN_WAIT_TIMEOUT
Waiting period for the polling loop to finish.protected SnapshotChangeEventSourceMetrics
snapshotMetrics
protected StreamingChangeEventSourceMetrics
streamingMetrics
protected 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
-
-
-
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
protected final Offsets<P extends Partition,O extends OffsetContext> previousOffsets
-
errorHandler
protected final ErrorHandler errorHandler
-
changeEventSourceFactory
protected final ChangeEventSourceFactory<P extends Partition,O extends OffsetContext> changeEventSourceFactory
-
changeEventSourceMetricsFactory
protected final ChangeEventSourceMetricsFactory changeEventSourceMetricsFactory
-
executor
protected final ExecutorService executor
-
eventDispatcher
protected final EventDispatcher<?> eventDispatcher
-
schema
protected final DatabaseSchema<?> schema
-
running
private volatile boolean running
-
streamingSource
protected volatile StreamingChangeEventSource<P extends Partition,O extends OffsetContext> streamingSource
-
commitOffsetLock
protected final ReentrantLock commitOffsetLock
-
snapshotMetrics
protected SnapshotChangeEventSourceMetrics snapshotMetrics
-
streamingMetrics
protected 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)
-
executeChangeEventSources
protected void executeChangeEventSources(CdcSourceTaskContext taskContext, SnapshotChangeEventSource<P,O> snapshotSource, Offsets<P,O> previousOffsets, AtomicReference<LoggingContext.PreviousContext> previousLogContext, ChangeEventSource.ChangeEventSourceContext context) throws InterruptedException
- Throws:
InterruptedException
-
doSnapshot
protected SnapshotResult<O> doSnapshot(SnapshotChangeEventSource<P,O> snapshotSource, ChangeEventSource.ChangeEventSourceContext context, P partition, O previousOffset) throws InterruptedException
- Throws:
InterruptedException
-
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
-
initStreamEvents
protected void initStreamEvents(O offsetContext) throws InterruptedException
- Throws:
InterruptedException
-
stop
public void stop() throws InterruptedException
Stops this coordinator.- Throws:
InterruptedException
-
streamingConnected
protected void streamingConnected(boolean status)
-
-