Package io.debezium.connector.postgresql
Class PostgresConnectorTask
java.lang.Object
org.apache.kafka.connect.source.SourceTask
io.debezium.connector.common.BaseSourceTask<PostgresPartition,PostgresOffsetContext>
io.debezium.connector.postgresql.PostgresConnectorTask
- All Implemented Interfaces:
org.apache.kafka.connect.connector.Task
Kafka connect source task which uses Postgres logical decoding over a streaming replication connection to process DB changes.
- Author:
- Horia Chiorean (hchiorea@redhat.com)
-
Nested Class Summary
Nested classes/interfaces inherited from class io.debezium.connector.common.BaseSourceTask
BaseSourceTask.StateNested classes/interfaces inherited from class org.apache.kafka.connect.source.SourceTask
org.apache.kafka.connect.source.SourceTask.TransactionBoundary -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PostgresConnectionprivate final ReentrantLockprivate static final Stringprivate ErrorHandlerprivate PostgresConnectionprivate static final org.slf4j.Loggerprivate Partition.Provider<PostgresPartition> private ChangeEventQueue<DataChangeEvent> private ReplicationConnectionprivate PostgresSchemaprivate PostgresTaskContextFields inherited from class io.debezium.connector.common.BaseSourceTask
coordinatorFields inherited from class org.apache.kafka.connect.source.SourceTask
context, TRANSACTION_BOUNDARY_CONFIG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidcheckWalLevel(PostgresConnection connection, SnapshotterService snapshotterService) voidcommit()voidcommitRecord(org.apache.kafka.connect.source.SourceRecord record) voidcommitRecord(org.apache.kafka.connect.source.SourceRecord record, org.apache.kafka.clients.producer.RecordMetadata metadata) createReplicationConnection(PostgresTaskContext taskContext, int maxRetries, Duration retryDelay) List<org.apache.kafka.connect.source.SourceRecord> doPoll()protected voiddoStop()private SlotStategetSlotState(PostgresConnectorConfig connectorConfig) start(Configuration config) private SlotCreationResulttryToCreateSlot(io.debezium.spi.snapshot.Snapshotter snapshotter, PostgresConnectorConfig connectorConfig, SlotState slotInfo) version()Methods inherited from class io.debezium.connector.common.BaseSourceTask
getAvailableSignalChannels, getNotificationChannels, getPreviousOffsets, getTaskState, isLogPositionAvailable, logStatistics, poll, registerServiceProviders, resetErrorHandlerRetriesIfNeeded, start, stop, validateAndLoadSchemaHistory, withMaskedSensitiveOptionsMethods inherited from class org.apache.kafka.connect.source.SourceTask
initialize
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
CONTEXT_NAME
- See Also:
-
taskContext
-
queue
-
jdbcConnection
-
beanRegistryJdbcConnection
-
replicationConnection
-
errorHandler
-
schema
-
partitionProvider
-
offsetContextLoader
-
commitLock
-
-
Constructor Details
-
PostgresConnectorTask
public PostgresConnectorTask()
-
-
Method Details
-
start
public ChangeEventSourceCoordinator<PostgresPartition,PostgresOffsetContext> start(Configuration config) - Specified by:
startin classBaseSourceTask<PostgresPartition,PostgresOffsetContext>
-
tryToCreateSlot
private SlotCreationResult tryToCreateSlot(io.debezium.spi.snapshot.Snapshotter snapshotter, PostgresConnectorConfig connectorConfig, SlotState slotInfo) -
getSlotState
-
createReplicationConnection
public ReplicationConnection createReplicationConnection(PostgresTaskContext taskContext, int maxRetries, Duration retryDelay) throws org.apache.kafka.connect.errors.ConnectException - Throws:
org.apache.kafka.connect.errors.ConnectException
-
doPoll
- Specified by:
doPollin classBaseSourceTask<PostgresPartition,PostgresOffsetContext> - Throws:
InterruptedException
-
doStop
protected void doStop()- Specified by:
doStopin classBaseSourceTask<PostgresPartition,PostgresOffsetContext>
-
version
-
getAllConfigurationFields
- Specified by:
getAllConfigurationFieldsin classBaseSourceTask<PostgresPartition,PostgresOffsetContext>
-
commitRecord
public void commitRecord(org.apache.kafka.connect.source.SourceRecord record, org.apache.kafka.clients.producer.RecordMetadata metadata) throws InterruptedException - Overrides:
commitRecordin classorg.apache.kafka.connect.source.SourceTask- Throws:
InterruptedException
-
commitRecord
public void commitRecord(org.apache.kafka.connect.source.SourceRecord record) throws InterruptedException - Overrides:
commitRecordin classBaseSourceTask<PostgresPartition,PostgresOffsetContext> - Throws:
InterruptedException
-
commit
- Overrides:
commitin classBaseSourceTask<PostgresPartition,PostgresOffsetContext> - Throws:
InterruptedException
-
getTaskContext
-
checkWalLevel
private static void checkWalLevel(PostgresConnection connection, SnapshotterService snapshotterService) throws SQLException - Throws:
SQLException
-