Class PostgresReplicationConnection.ReplicationConnectionBuilder
- java.lang.Object
-
- io.debezium.connector.postgresql.connection.PostgresReplicationConnection.ReplicationConnectionBuilder
-
- All Implemented Interfaces:
ReplicationConnection.Builder
- Enclosing class:
- PostgresReplicationConnection
protected static class PostgresReplicationConnection.ReplicationConnectionBuilder extends Object implements ReplicationConnection.Builder
-
-
Field Summary
Fields Modifier and Type Field Description private PostgresConnectorConfigconfigprivate booleandoSnapshotprivate booleandropSlotOnCloseprivate PostgresConnectorConfig.LogicalDecoderpluginprivate PostgresConnectorConfig.AutoCreateModepublicationAutocreateModeprivate StringpublicationNameprivate PostgresSchemaschemaprivate StringslotNameprivate PropertiesslotStreamParamsprivate DurationstatusUpdateIntervalValprivate RelationalTableFilterstableFilterprivate PostgresConnectorConfig.TruncateHandlingModetruncateHandlingModeprivate TypeRegistrytypeRegistry-
Fields inherited from interface io.debezium.connector.postgresql.connection.ReplicationConnection.Builder
DEFAULT_DROP_SLOT_ON_CLOSE, DEFAULT_PUBLICATION_NAME, DEFAULT_SLOT_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedReplicationConnectionBuilder(PostgresConnectorConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReplicationConnectionbuild()Creates a newReplicationConnectioninstanceReplicationConnection.BuilderdoSnapshot(boolean doSnapshot)Whether or not the snapshot is executedPostgresReplicationConnection.ReplicationConnectionBuilderdropSlotOnClose(boolean dropSlotOnClose)Whether or not to drop the replication slot once the replication connection closesPostgresReplicationConnection.ReplicationConnectionBuilderstatusUpdateInterval(Duration statusUpdateInterval)The number of milli-seconds the replication connection should periodically send updates to the server.PostgresReplicationConnection.ReplicationConnectionBuilderstreamParams(String slotStreamParams)Optional parameters to pass to the logical decoder when the stream starts.PostgresReplicationConnection.ReplicationConnectionBuilderwithPlugin(PostgresConnectorConfig.LogicalDecoder plugin)Sets the instance for the PG logical decoding pluginReplicationConnection.BuilderwithPublication(String publicationName)Sets the publication name for the PG logical publicationReplicationConnection.BuilderwithPublicationAutocreateMode(PostgresConnectorConfig.AutoCreateMode publicationAutocreateMode)Sets the publication autocreate mode for the PG logical publicationReplicationConnection.BuilderwithSchema(PostgresSchema schema)Sets the schema instancePostgresReplicationConnection.ReplicationConnectionBuilderwithSlot(String slotName)Sets the name for the PG logical replication slotReplicationConnection.BuilderwithTableFilter(RelationalTableFilters tableFilter)Sets the publication tables to watch for the PG logical publicationReplicationConnection.BuilderwithTruncateHandlingMode(PostgresConnectorConfig.TruncateHandlingMode truncateHandlingMode)Sets the instance for the Truncate handling modeReplicationConnection.BuilderwithTypeRegistry(TypeRegistry typeRegistry)
-
-
-
Field Detail
-
config
private final PostgresConnectorConfig config
-
slotName
private String slotName
-
publicationName
private String publicationName
-
tableFilter
private RelationalTableFilters tableFilter
-
publicationAutocreateMode
private PostgresConnectorConfig.AutoCreateMode publicationAutocreateMode
-
plugin
private PostgresConnectorConfig.LogicalDecoder plugin
-
truncateHandlingMode
private PostgresConnectorConfig.TruncateHandlingMode truncateHandlingMode
-
dropSlotOnClose
private boolean dropSlotOnClose
-
statusUpdateIntervalVal
private Duration statusUpdateIntervalVal
-
doSnapshot
private boolean doSnapshot
-
typeRegistry
private TypeRegistry typeRegistry
-
schema
private PostgresSchema schema
-
slotStreamParams
private Properties slotStreamParams
-
-
Constructor Detail
-
ReplicationConnectionBuilder
protected ReplicationConnectionBuilder(PostgresConnectorConfig config)
-
-
Method Detail
-
withSlot
public PostgresReplicationConnection.ReplicationConnectionBuilder withSlot(String slotName)
Description copied from interface:ReplicationConnection.BuilderSets the name for the PG logical replication slot- Specified by:
withSlotin interfaceReplicationConnection.Builder- Parameters:
slotName- the name of the slot, may not be null.- Returns:
- this instance
- See Also:
ReplicationConnection.Builder.DEFAULT_SLOT_NAME
-
withPublication
public ReplicationConnection.Builder withPublication(String publicationName)
Description copied from interface:ReplicationConnection.BuilderSets the publication name for the PG logical publication- Specified by:
withPublicationin interfaceReplicationConnection.Builder- Parameters:
publicationName- the name of the publication, may not be null.- Returns:
- this instance
- See Also:
ReplicationConnection.Builder.DEFAULT_PUBLICATION_NAME
-
withTableFilter
public ReplicationConnection.Builder withTableFilter(RelationalTableFilters tableFilter)
Description copied from interface:ReplicationConnection.BuilderSets the publication tables to watch for the PG logical publication- Specified by:
withTableFilterin interfaceReplicationConnection.Builder- Parameters:
tableFilter- the configured table filters- Returns:
- this instance
-
withPublicationAutocreateMode
public ReplicationConnection.Builder withPublicationAutocreateMode(PostgresConnectorConfig.AutoCreateMode publicationAutocreateMode)
Description copied from interface:ReplicationConnection.BuilderSets the publication autocreate mode for the PG logical publication- Specified by:
withPublicationAutocreateModein interfaceReplicationConnection.Builder- Parameters:
publicationAutocreateMode- the name of the publication, may not be null.- Returns:
- this instance
-
withPlugin
public PostgresReplicationConnection.ReplicationConnectionBuilder withPlugin(PostgresConnectorConfig.LogicalDecoder plugin)
Description copied from interface:ReplicationConnection.BuilderSets the instance for the PG logical decoding plugin- Specified by:
withPluginin interfaceReplicationConnection.Builder- Returns:
- this instance
- See Also:
#PROTOBUF_PLUGIN_NAME
-
withTruncateHandlingMode
public ReplicationConnection.Builder withTruncateHandlingMode(PostgresConnectorConfig.TruncateHandlingMode truncateHandlingMode)
Description copied from interface:ReplicationConnection.BuilderSets the instance for the Truncate handling mode- Specified by:
withTruncateHandlingModein interfaceReplicationConnection.Builder- Parameters:
truncateHandlingMode- Truncate handling mode, may not be null.- Returns:
- this instance
- See Also:
PostgresConnectorConfig.TruncateHandlingMode
-
dropSlotOnClose
public PostgresReplicationConnection.ReplicationConnectionBuilder dropSlotOnClose(boolean dropSlotOnClose)
Description copied from interface:ReplicationConnection.BuilderWhether or not to drop the replication slot once the replication connection closes- Specified by:
dropSlotOnClosein interfaceReplicationConnection.Builder- Parameters:
dropSlotOnClose- true if the slot should be dropped once the connection is closed, false otherwise- Returns:
- this instance
- See Also:
ReplicationConnection.Builder.DEFAULT_DROP_SLOT_ON_CLOSE
-
streamParams
public PostgresReplicationConnection.ReplicationConnectionBuilder streamParams(String slotStreamParams)
Description copied from interface:ReplicationConnection.BuilderOptional parameters to pass to the logical decoder when the stream starts.- Specified by:
streamParamsin interfaceReplicationConnection.Builder- Parameters:
slotStreamParams- String of key and value pairs declared with "=". Pairs are separated by ";". Example: "add-tables=public.table,public.table2;include-lsn=true"- Returns:
- this instance
- See Also:
#STREAM_PARAMS
-
statusUpdateInterval
public PostgresReplicationConnection.ReplicationConnectionBuilder statusUpdateInterval(Duration statusUpdateInterval)
Description copied from interface:ReplicationConnection.BuilderThe number of milli-seconds the replication connection should periodically send updates to the server.- Specified by:
statusUpdateIntervalin interfaceReplicationConnection.Builder- Parameters:
statusUpdateInterval- a duration; null or non-positive value causes Postgres' default to be applied- Returns:
- this instance
-
doSnapshot
public ReplicationConnection.Builder doSnapshot(boolean doSnapshot)
Description copied from interface:ReplicationConnection.BuilderWhether or not the snapshot is executed- Specified by:
doSnapshotin interfaceReplicationConnection.Builder- Parameters:
doSnapshot- true if a snapshot is going to be executed, false if otherwise- Returns:
- this instance
-
build
public ReplicationConnection build()
Description copied from interface:ReplicationConnection.BuilderCreates a newReplicationConnectioninstance- Specified by:
buildin interfaceReplicationConnection.Builder- Returns:
- a connection, never null
-
withTypeRegistry
public ReplicationConnection.Builder withTypeRegistry(TypeRegistry typeRegistry)
- Specified by:
withTypeRegistryin interfaceReplicationConnection.Builder
-
withSchema
public ReplicationConnection.Builder withSchema(PostgresSchema schema)
Description copied from interface:ReplicationConnection.BuilderSets the schema instance- Specified by:
withSchemain interfaceReplicationConnection.Builder- Parameters:
schema- the schema, must not be null- Returns:
- this instance
-
-