Interface ReplicationConnection.Builder
-
- All Known Implementing Classes:
PostgresReplicationConnection.ReplicationConnectionBuilder
- Enclosing interface:
- ReplicationConnection
public static interface ReplicationConnection.BuilderA builder forReplicationConnection
-
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_DROP_SLOT_ON_CLOSEstatic StringDEFAULT_PUBLICATION_NAMEstatic StringDEFAULT_SLOT_NAMEDefault replication settings
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ReplicationConnectionbuild()Creates a newReplicationConnectioninstanceReplicationConnection.BuilderdoSnapshot(boolean doSnapshot)Whether or not the snapshot is executedReplicationConnection.BuilderdropSlotOnClose(boolean dropSlotOnClose)Whether or not to drop the replication slot once the replication connection closesReplicationConnection.BuilderstatusUpdateInterval(Duration statusUpdateInterval)The number of milli-seconds the replication connection should periodically send updates to the server.ReplicationConnection.BuilderstreamParams(String streamParams)Optional parameters to pass to the logical decoder when the stream starts.ReplicationConnection.BuilderwithPlugin(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 instanceReplicationConnection.BuilderwithSlot(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
-
DEFAULT_SLOT_NAME
static final String DEFAULT_SLOT_NAME
Default replication settings- See Also:
- Constant Field Values
-
DEFAULT_PUBLICATION_NAME
static final String DEFAULT_PUBLICATION_NAME
- See Also:
- Constant Field Values
-
DEFAULT_DROP_SLOT_ON_CLOSE
static final boolean DEFAULT_DROP_SLOT_ON_CLOSE
- See Also:
- Constant Field Values
-
-
Method Detail
-
withSlot
ReplicationConnection.Builder withSlot(String slotName)
Sets the name for the PG logical replication slot- Parameters:
slotName- the name of the slot, may not be null.- Returns:
- this instance
- See Also:
DEFAULT_SLOT_NAME
-
withPublication
ReplicationConnection.Builder withPublication(String publicationName)
Sets the publication name for the PG logical publication- Parameters:
publicationName- the name of the publication, may not be null.- Returns:
- this instance
- See Also:
DEFAULT_PUBLICATION_NAME
-
withTableFilter
ReplicationConnection.Builder withTableFilter(RelationalTableFilters tableFilter)
Sets the publication tables to watch for the PG logical publication- Parameters:
tableFilter- the configured table filters- Returns:
- this instance
-
withPublicationAutocreateMode
ReplicationConnection.Builder withPublicationAutocreateMode(PostgresConnectorConfig.AutoCreateMode publicationAutocreateMode)
Sets the publication autocreate mode for the PG logical publication- Parameters:
publicationAutocreateMode- the name of the publication, may not be null.- Returns:
- this instance
-
withPlugin
ReplicationConnection.Builder withPlugin(PostgresConnectorConfig.LogicalDecoder plugin)
Sets the instance for the PG logical decoding plugin- Parameters:
pluginName- the name of the slot, may not be null.- Returns:
- this instance
- See Also:
#PROTOBUF_PLUGIN_NAME
-
withTruncateHandlingMode
ReplicationConnection.Builder withTruncateHandlingMode(PostgresConnectorConfig.TruncateHandlingMode truncateHandlingMode)
Sets the instance for the Truncate handling mode- Parameters:
truncateHandlingMode- Truncate handling mode, may not be null.- Returns:
- this instance
- See Also:
PostgresConnectorConfig.TruncateHandlingMode
-
dropSlotOnClose
ReplicationConnection.Builder dropSlotOnClose(boolean dropSlotOnClose)
Whether or not to drop the replication slot once the replication connection closes- Parameters:
dropSlotOnClose- true if the slot should be dropped once the connection is closed, false otherwise- Returns:
- this instance
- See Also:
DEFAULT_DROP_SLOT_ON_CLOSE
-
statusUpdateInterval
ReplicationConnection.Builder statusUpdateInterval(Duration statusUpdateInterval)
The number of milli-seconds the replication connection should periodically send updates to the server.- Parameters:
statusUpdateInterval- a duration; null or non-positive value causes Postgres' default to be applied- Returns:
- this instance
-
withTypeRegistry
ReplicationConnection.Builder withTypeRegistry(TypeRegistry typeRegistry)
-
withSchema
ReplicationConnection.Builder withSchema(PostgresSchema schema)
Sets the schema instance- Parameters:
schema- the schema, must not be null- Returns:
- this instance
-
streamParams
ReplicationConnection.Builder streamParams(String streamParams)
Optional parameters to pass to the logical decoder when the stream starts.- Parameters:
streamParams- 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
-
doSnapshot
ReplicationConnection.Builder doSnapshot(boolean doSnapshot)
Whether or not the snapshot is executed- Parameters:
doSnapshot- true if a snapshot is going to be executed, false if otherwise- Returns:
- this instance
-
build
ReplicationConnection build()
Creates a newReplicationConnectioninstance- Returns:
- a connection, never null
-
-