Package io.debezium.pipeline.source.spi
Interface StreamingChangeEventSource<P extends Partition,O extends OffsetContext>
- All Superinterfaces:
ChangeEventSource
public interface StreamingChangeEventSource<P extends Partition,O extends OffsetContext>
extends ChangeEventSource
A change event source that emits events from a DB log, such as MySQL's binlog or similar.
- Author:
- Gunnar Morling
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.debezium.pipeline.source.spi.ChangeEventSource
ChangeEventSource.ChangeEventSourceContext
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
commitOffset
(Map<String, ?> partition, Map<String, ?> offset) Commits the given offset with the source database.void
execute
(ChangeEventSource.ChangeEventSourceContext context, P partition, O offsetContext) Executes this source.default boolean
executeIteration
(ChangeEventSource.ChangeEventSourceContext context, P partition, O offsetContext) Executes this source for a single execution iteration.default O
default void
Initializes the streaming source.
-
Method Details
-
init
Initializes the streaming source. Called before incremental snapshot init.- Throws:
InterruptedException
-
execute
void execute(ChangeEventSource.ChangeEventSourceContext context, P partition, O offsetContext) throws InterruptedException Executes this source. Implementations should regularly check via the given context if they should stop. If that's the case, they should abort their processing and perform any clean-up needed, such as rolling back pending transactions, releasing locks etc.- Parameters:
context
- contextual information for this source's executionpartition
- the source partition from which the changes should be streamedoffsetContext
-- Throws:
InterruptedException
- in case the snapshot was aborted before completion
-
executeIteration
default boolean executeIteration(ChangeEventSource.ChangeEventSourceContext context, P partition, O offsetContext) throws InterruptedException Executes this source for a single execution iteration. This is useful for iterating over multiple partitions and performing an action if events were processed. For example, pausing a connector once no events were produced after iterating over all partitions. Implementations should regularly check via the given context if they should stop. If that's the case, they should abort their processing and perform any clean-up needed, such as rolling back pending transactions, releasing locks etc.- Parameters:
context
- contextual information for this source's executionpartition
- the source partition from which the changes should be streamedoffsetContext
-- Returns:
- true if events were processed during the iteration or false otherwise.
- Throws:
InterruptedException
- in case the snapshot was aborted before completion
-
commitOffset
Commits the given offset with the source database. Used by some connectors like Postgres and Oracle to indicate how far the source TX log can be discarded. -
getOffsetContext
-