Package io.debezium.connector.oracle
Class BaseChangeRecordEmitter<T>
java.lang.Object
io.debezium.pipeline.AbstractChangeRecordEmitter<P,TableSchema>
io.debezium.relational.RelationalChangeRecordEmitter
io.debezium.connector.oracle.BaseChangeRecordEmitter<T>
- All Implemented Interfaces:
ChangeRecordEmitter
- Direct Known Subclasses:
LogMinerChangeRecordEmitter,XStreamChangeRecordEmitter
Base class to emit change data based on a single entry event.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.debezium.pipeline.spi.ChangeRecordEmitter
ChangeRecordEmitter.Receiver<P extends Partition> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final OracleConnectorConfigprivate static final org.slf4j.Loggerprivate final Object[]private final Object[]private final OracleDatabaseSchemaprotected final TableFields inherited from class io.debezium.relational.RelationalChangeRecordEmitter
PK_UPDATE_NEWKEY_FIELD, PK_UPDATE_OLDKEY_FIELD -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseChangeRecordEmitter(OracleConnectorConfig connectorConfig, Partition partition, OffsetContext offset, OracleDatabaseSchema schema, Table table, Clock clock, Object[] oldColumnValues, Object[] newColumnValues) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidemitTruncateRecord(ChangeRecordEmitter.Receiver receiver, TableSchema tableSchema) protected voidemitUpdateAsPrimaryKeyChangeRecord(ChangeRecordEmitter.Receiver receiver, TableSchema tableSchema, org.apache.kafka.connect.data.Struct oldKey, org.apache.kafka.connect.data.Struct newKey, org.apache.kafka.connect.data.Struct oldValue, org.apache.kafka.connect.data.Struct newValue) protected Object[]protected Object[]getReselectColumns(org.apache.kafka.connect.data.Struct newValue) Returns a list of columns that should be reselected.private StringgetReselectQuery(List<Column> reselectColumns, Table table, OracleConnection connection) Creates the reselect query, a query that explicitly only selects the LOB-based columns from the underlying relational table based on the event's current primary key value set.private voidprepareReselectQueryStatement(PreparedStatement ps, Table table, org.apache.kafka.connect.data.Struct newKey) Prepares the reselect query, binding the primary key column valuesprivate voidupdateNewValuesFromReselectQueryResults(ResultSet rs, List<Column> reselectColumns) Applies the reselect query results to the new column values object array.Methods inherited from class io.debezium.relational.RelationalChangeRecordEmitter
emitChangeRecords, emitCreateRecord, emitDeleteRecord, emitReadRecord, emitUpdateRecord, skipEmptyMessagesMethods inherited from class io.debezium.pipeline.AbstractChangeRecordEmitter
getClock, getOffset, getPartitionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.debezium.pipeline.spi.ChangeRecordEmitter
getOperation
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
connectorConfig
-
oldColumnValues
-
newColumnValues
-
schema
-
table
-
-
Constructor Details
-
BaseChangeRecordEmitter
protected BaseChangeRecordEmitter(OracleConnectorConfig connectorConfig, Partition partition, OffsetContext offset, OracleDatabaseSchema schema, Table table, Clock clock, Object[] oldColumnValues, Object[] newColumnValues)
-
-
Method Details
-
getOldColumnValues
- Specified by:
getOldColumnValuesin classRelationalChangeRecordEmitter
-
getNewColumnValues
- Specified by:
getNewColumnValuesin classRelationalChangeRecordEmitter
-
emitTruncateRecord
protected void emitTruncateRecord(ChangeRecordEmitter.Receiver receiver, TableSchema tableSchema) throws InterruptedException - Overrides:
emitTruncateRecordin classRelationalChangeRecordEmitter- Throws:
InterruptedException
-
emitUpdateAsPrimaryKeyChangeRecord
protected void emitUpdateAsPrimaryKeyChangeRecord(ChangeRecordEmitter.Receiver receiver, TableSchema tableSchema, org.apache.kafka.connect.data.Struct oldKey, org.apache.kafka.connect.data.Struct newKey, org.apache.kafka.connect.data.Struct oldValue, org.apache.kafka.connect.data.Struct newValue) throws InterruptedException - Overrides:
emitUpdateAsPrimaryKeyChangeRecordin classRelationalChangeRecordEmitter- Throws:
InterruptedException
-
getReselectColumns
Returns a list of columns that should be reselected. Currently, this method is only concerned about LOB-based columns and so if a table does not have any LOB columns or if the LOB column's value is not the unavailable value placeholder configured in the connector configuration, this method may return no columns indicating that a reselection is not required for the change event.- Parameters:
newValue- the currently constructed new value payload for the change event, should not be null- Returns:
- list of columns that should be reselected, which can be empty
-
getReselectQuery
private String getReselectQuery(List<Column> reselectColumns, Table table, OracleConnection connection) Creates the reselect query, a query that explicitly only selects the LOB-based columns from the underlying relational table based on the event's current primary key value set.- Parameters:
reselectColumns- the columns that should be reselected, should never be null or emptytable- the relational table modelconnection- the database connection- Returns:
- the query string for the reselect query
-
prepareReselectQueryStatement
private void prepareReselectQueryStatement(PreparedStatement ps, Table table, org.apache.kafka.connect.data.Struct newKey) throws SQLException Prepares the reselect query, binding the primary key column values- Parameters:
ps- the prepared statementtable- the relational model tablenewKey- the row's new key- Throws:
SQLException- if a database error occurred
-
updateNewValuesFromReselectQueryResults
private void updateNewValuesFromReselectQueryResults(ResultSet rs, List<Column> reselectColumns) throws SQLException Applies the reselect query results to the new column values object array.- Parameters:
rs- the reselect query result setreselectColumns- the columns that were re-selected- Throws:
SQLException- if a database error occurred
-