Package io.debezium.connector.db2
Class Db2SnapshotChangeEventSource
- java.lang.Object
-
- io.debezium.pipeline.source.AbstractSnapshotChangeEventSource<O>
-
- io.debezium.relational.RelationalSnapshotChangeEventSource<Db2OffsetContext>
-
- io.debezium.connector.db2.Db2SnapshotChangeEventSource
-
- All Implemented Interfaces:
io.debezium.pipeline.source.spi.ChangeEventSource,io.debezium.pipeline.source.spi.SnapshotChangeEventSource<Db2OffsetContext>
public class Db2SnapshotChangeEventSource extends io.debezium.relational.RelationalSnapshotChangeEventSource<Db2OffsetContext>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDb2SnapshotChangeEventSource.Db2SnapshotContextMutable context which is populated in the course of snapshotting.-
Nested classes/interfaces inherited from class io.debezium.relational.RelationalSnapshotChangeEventSource
io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<O extends io.debezium.pipeline.spi.OffsetContext>
-
Nested classes/interfaces inherited from class io.debezium.pipeline.source.AbstractSnapshotChangeEventSource
io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshotContext<O extends io.debezium.pipeline.spi.OffsetContext>, io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshottingTask
-
-
Field Summary
Fields Modifier and Type Field Description private Db2ConnectorConfigconnectorConfigprivate Db2ConnectionjdbcConnectionprivate static org.slf4j.LoggerLOGGER
-
Constructor Summary
Constructors Constructor Description Db2SnapshotChangeEventSource(Db2ConnectorConfig connectorConfig, Db2Connection jdbcConnection, Db2DatabaseSchema schema, io.debezium.pipeline.EventDispatcher<io.debezium.relational.TableId> dispatcher, io.debezium.util.Clock clock, io.debezium.pipeline.source.spi.SnapshotProgressListener snapshotProgressListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcomplete(io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshotContext<Db2OffsetContext> snapshotContext)protected voidconnectionCreated(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext)protected voiddetermineSnapshotOffset(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> ctx, Db2OffsetContext previousOffset)protected Set<io.debezium.relational.TableId>getAllTableIds(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> ctx)protected io.debezium.schema.SchemaChangeEventgetCreateTableEvent(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext, io.debezium.relational.Table table)protected Optional<String>getSnapshotSelect(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext, io.debezium.relational.TableId tableId)Generate a valid db2 query string for the specified tableprotected io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshottingTaskgetSnapshottingTask(Db2OffsetContext previousOffset)protected voidlockTablesForSchemaSnapshot(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext sourceContext, io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext)protected io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshotContext<Db2OffsetContext>prepare(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext context)protected voidreadTableStructure(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext sourceContext, io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext, Db2OffsetContext previousOffset)protected voidreleaseSchemaSnapshotLocks(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext)-
Methods inherited from class io.debezium.relational.RelationalSnapshotChangeEventSource
createSchemaChangeEventsForTables, createSnapshotConnection, doExecute, enhanceOverriddenSelect, getChangeRecordEmitter, getClock, getColumnValue, lastSnapshotRecord, postSnapshot, readTableStatement, releaseDataSnapshotLocks, rowCountForTable, schema, tryStartingSnapshot
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
connectorConfig
private final Db2ConnectorConfig connectorConfig
-
jdbcConnection
private final Db2Connection jdbcConnection
-
-
Constructor Detail
-
Db2SnapshotChangeEventSource
public Db2SnapshotChangeEventSource(Db2ConnectorConfig connectorConfig, Db2Connection jdbcConnection, Db2DatabaseSchema schema, io.debezium.pipeline.EventDispatcher<io.debezium.relational.TableId> dispatcher, io.debezium.util.Clock clock, io.debezium.pipeline.source.spi.SnapshotProgressListener snapshotProgressListener)
-
-
Method Detail
-
getSnapshottingTask
protected io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshottingTask getSnapshottingTask(Db2OffsetContext previousOffset)
- Specified by:
getSnapshottingTaskin classio.debezium.pipeline.source.AbstractSnapshotChangeEventSource<Db2OffsetContext>
-
prepare
protected io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshotContext<Db2OffsetContext> prepare(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext context) throws Exception
- Specified by:
preparein classio.debezium.pipeline.source.AbstractSnapshotChangeEventSource<Db2OffsetContext>- Throws:
Exception
-
connectionCreated
protected void connectionCreated(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext) throws Exception
- Overrides:
connectionCreatedin classio.debezium.relational.RelationalSnapshotChangeEventSource<Db2OffsetContext>- Throws:
Exception
-
getAllTableIds
protected Set<io.debezium.relational.TableId> getAllTableIds(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> ctx) throws Exception
- Specified by:
getAllTableIdsin classio.debezium.relational.RelationalSnapshotChangeEventSource<Db2OffsetContext>- Throws:
Exception
-
lockTablesForSchemaSnapshot
protected void lockTablesForSchemaSnapshot(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext sourceContext, io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext) throws SQLException, InterruptedException- Specified by:
lockTablesForSchemaSnapshotin classio.debezium.relational.RelationalSnapshotChangeEventSource<Db2OffsetContext>- Throws:
SQLExceptionInterruptedException
-
releaseSchemaSnapshotLocks
protected void releaseSchemaSnapshotLocks(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext) throws SQLException
- Specified by:
releaseSchemaSnapshotLocksin classio.debezium.relational.RelationalSnapshotChangeEventSource<Db2OffsetContext>- Throws:
SQLException
-
determineSnapshotOffset
protected void determineSnapshotOffset(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> ctx, Db2OffsetContext previousOffset) throws Exception
- Specified by:
determineSnapshotOffsetin classio.debezium.relational.RelationalSnapshotChangeEventSource<Db2OffsetContext>- Throws:
Exception
-
readTableStructure
protected void readTableStructure(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext sourceContext, io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext, Db2OffsetContext previousOffset) throws SQLException, InterruptedException- Specified by:
readTableStructurein classio.debezium.relational.RelationalSnapshotChangeEventSource<Db2OffsetContext>- Throws:
SQLExceptionInterruptedException
-
getCreateTableEvent
protected io.debezium.schema.SchemaChangeEvent getCreateTableEvent(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext, io.debezium.relational.Table table) throws SQLException
- Specified by:
getCreateTableEventin classio.debezium.relational.RelationalSnapshotChangeEventSource<Db2OffsetContext>- Throws:
SQLException
-
complete
protected void complete(io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshotContext<Db2OffsetContext> snapshotContext)
- Overrides:
completein classio.debezium.pipeline.source.AbstractSnapshotChangeEventSource<Db2OffsetContext>
-
getSnapshotSelect
protected Optional<String> getSnapshotSelect(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext<Db2OffsetContext> snapshotContext, io.debezium.relational.TableId tableId)
Generate a valid db2 query string for the specified table- Specified by:
getSnapshotSelectin classio.debezium.relational.RelationalSnapshotChangeEventSource<Db2OffsetContext>- Parameters:
tableId- the table to generate a query for- Returns:
- a valid query string
-
-