Package io.debezium.connector.db2
Class Db2SnapshotChangeEventSource
- java.lang.Object
-
- io.debezium.pipeline.source.AbstractSnapshotChangeEventSource
-
- io.debezium.relational.RelationalSnapshotChangeEventSource
-
- io.debezium.connector.db2.Db2SnapshotChangeEventSource
-
- All Implemented Interfaces:
io.debezium.pipeline.source.spi.ChangeEventSource,io.debezium.pipeline.source.spi.SnapshotChangeEventSource
public class Db2SnapshotChangeEventSource extends io.debezium.relational.RelationalSnapshotChangeEventSource
-
-
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
-
-
Field Summary
Fields Modifier and Type Field Description private Db2ConnectorConfigconnectorConfigprivate Db2ConnectionjdbcConnectionprivate static org.slf4j.LoggerLOGGER
-
Constructor Summary
Constructors Constructor Description Db2SnapshotChangeEventSource(Db2ConnectorConfig connectorConfig, Db2OffsetContext previousOffset, 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 snapshotContext)protected voidconnectionCreated(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext)protected voiddetermineSnapshotOffset(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext ctx)protected Set<io.debezium.relational.TableId>getAllTableIds(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext ctx)protected io.debezium.schema.SchemaChangeEventgetCreateTableEvent(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext, io.debezium.relational.Table table)protected Optional<String>getSnapshotSelect(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext, io.debezium.relational.TableId tableId)Generate a valid db2 query string for the specified tableprotected io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshottingTaskgetSnapshottingTask(io.debezium.pipeline.spi.OffsetContext previousOffset)protected voidlockTablesForSchemaSnapshot(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext sourceContext, io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext)protected io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshotContextprepare(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext context)protected voidreadTableStructure(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext sourceContext, io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext)protected voidreleaseSchemaSnapshotLocks(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext)-
Methods inherited from class io.debezium.relational.RelationalSnapshotChangeEventSource
createSchemaChangeEventsForTables, createSnapshotConnection, doExecute, enhanceOverriddenSelect, getChangeRecordEmitter, getClock, getColumnValue, lastSnapshotRecord, postSnapshot, readTableStatement, releaseDataSnapshotLocks, rowCountForTable, 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, Db2OffsetContext previousOffset, 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(io.debezium.pipeline.spi.OffsetContext previousOffset)
- Specified by:
getSnapshottingTaskin classio.debezium.pipeline.source.AbstractSnapshotChangeEventSource
-
prepare
protected io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshotContext prepare(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext context) throws Exception- Specified by:
preparein classio.debezium.pipeline.source.AbstractSnapshotChangeEventSource- Throws:
Exception
-
connectionCreated
protected void connectionCreated(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext) throws Exception- Overrides:
connectionCreatedin classio.debezium.relational.RelationalSnapshotChangeEventSource- Throws:
Exception
-
getAllTableIds
protected Set<io.debezium.relational.TableId> getAllTableIds(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext ctx) throws Exception
- Specified by:
getAllTableIdsin classio.debezium.relational.RelationalSnapshotChangeEventSource- Throws:
Exception
-
lockTablesForSchemaSnapshot
protected void lockTablesForSchemaSnapshot(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext sourceContext, io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext) throws SQLException, InterruptedException- Specified by:
lockTablesForSchemaSnapshotin classio.debezium.relational.RelationalSnapshotChangeEventSource- Throws:
SQLExceptionInterruptedException
-
releaseSchemaSnapshotLocks
protected void releaseSchemaSnapshotLocks(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext) throws SQLException- Specified by:
releaseSchemaSnapshotLocksin classio.debezium.relational.RelationalSnapshotChangeEventSource- Throws:
SQLException
-
determineSnapshotOffset
protected void determineSnapshotOffset(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext ctx) throws Exception- Specified by:
determineSnapshotOffsetin classio.debezium.relational.RelationalSnapshotChangeEventSource- Throws:
Exception
-
readTableStructure
protected void readTableStructure(io.debezium.pipeline.source.spi.ChangeEventSource.ChangeEventSourceContext sourceContext, io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext) throws SQLException, InterruptedException- Specified by:
readTableStructurein classio.debezium.relational.RelationalSnapshotChangeEventSource- Throws:
SQLExceptionInterruptedException
-
getCreateTableEvent
protected io.debezium.schema.SchemaChangeEvent getCreateTableEvent(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext, io.debezium.relational.Table table) throws SQLException- Specified by:
getCreateTableEventin classio.debezium.relational.RelationalSnapshotChangeEventSource- Throws:
SQLException
-
complete
protected void complete(io.debezium.pipeline.source.AbstractSnapshotChangeEventSource.SnapshotContext snapshotContext)
- Overrides:
completein classio.debezium.pipeline.source.AbstractSnapshotChangeEventSource
-
getSnapshotSelect
protected Optional<String> getSnapshotSelect(io.debezium.relational.RelationalSnapshotChangeEventSource.RelationalSnapshotContext snapshotContext, io.debezium.relational.TableId tableId)
Generate a valid db2 query string for the specified table- Specified by:
getSnapshotSelectin classio.debezium.relational.RelationalSnapshotChangeEventSource- Parameters:
tableId- the table to generate a query for- Returns:
- a valid query string
-
-