Class LogicalStreamBuilder
java.lang.Object
org.postgresql.replication.fluent.AbstractStreamBuilder<ChainedLogicalStreamBuilder>
org.postgresql.replication.fluent.logical.LogicalStreamBuilder
- All Implemented Interfaces:
ChainedCommonStreamBuilder<ChainedLogicalStreamBuilder>
,CommonOptions
,ChainedLogicalStreamBuilder
,LogicalReplicationOptions
public class LogicalStreamBuilder
extends AbstractStreamBuilder<ChainedLogicalStreamBuilder>
implements ChainedLogicalStreamBuilder, LogicalReplicationOptions
-
Field Summary
Fields inherited from class org.postgresql.replication.fluent.AbstractStreamBuilder
slotName, startPosition, statusIntervalMs
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
Required parameter for logical replication.Parameters for output plugin.int
Specifies the number of millisecond between status packets sent back to the server.protected ChainedLogicalStreamBuilder
self()
start()
Open logical replication stream.withSlotOption
(String optionName, boolean optionValue) withSlotOption
(String optionName, int optionValue) withSlotOption
(String optionName, String optionValue) withSlotOptions
(Properties options) Specify start position from which backend will start stream changes.Methods inherited from class org.postgresql.replication.fluent.AbstractStreamBuilder
withSlotName, withStatusInterval
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.postgresql.replication.fluent.ChainedCommonStreamBuilder
withSlotName, withStatusInterval
-
Constructor Details
-
LogicalStreamBuilder
- Parameters:
startCallback
- not null callback that should be execute after build parameters for start replication
-
-
Method Details
-
self
- Specified by:
self
in classAbstractStreamBuilder<ChainedLogicalStreamBuilder>
-
start
Description copied from interface:ChainedLogicalStreamBuilder
Open logical replication stream.- Specified by:
start
in interfaceChainedLogicalStreamBuilder
- Returns:
- not null PGReplicationStream available for fetch data in logical form
- Throws:
SQLException
- if there are errors
-
getSlotName
Description copied from interface:LogicalReplicationOptions
Required parameter for logical replication.- Specified by:
getSlotName
in interfaceCommonOptions
- Specified by:
getSlotName
in interfaceLogicalReplicationOptions
- Returns:
- not null logical replication slot name that already exists on server and free.
-
withStartPosition
Description copied from interface:ChainedCommonStreamBuilder
Specify start position from which backend will start stream changes. If parameter will not specify, streaming starts from restart_lsn. For more details see pg_replication_slots description.- Specified by:
withStartPosition
in interfaceChainedCommonStreamBuilder<ChainedLogicalStreamBuilder>
- Overrides:
withStartPosition
in classAbstractStreamBuilder<ChainedLogicalStreamBuilder>
- Parameters:
lsn
- not null position from which need start replicate changes- Returns:
- not null fluent
-
withSlotOption
- Specified by:
withSlotOption
in interfaceChainedLogicalStreamBuilder
- Parameters:
optionName
- name of optionoptionValue
- boolean value- Returns:
- ChainedLogicalStreamBuilder
-
withSlotOption
- Specified by:
withSlotOption
in interfaceChainedLogicalStreamBuilder
- Parameters:
optionName
- name of optionoptionValue
- integer value- Returns:
- ChainedLogicalStreamBuilder
-
withSlotOption
- Specified by:
withSlotOption
in interfaceChainedLogicalStreamBuilder
- Parameters:
optionName
- name of optionoptionValue
- String value- Returns:
- ChainedLogicalStreamBuilder
-
withSlotOptions
- Specified by:
withSlotOptions
in interfaceChainedLogicalStreamBuilder
- Parameters:
options
- properties- Returns:
- ChainedLogicalStreamBuilder
-
getStartLSNPosition
- Specified by:
getStartLSNPosition
in interfaceCommonOptions
- Returns:
- the position to start replication. This cannot be null.
-
getSlotOptions
Description copied from interface:LogicalReplicationOptions
Parameters for output plugin. Parameters will be set to output plugin that register for specified replication slot name.- Specified by:
getSlotOptions
in interfaceLogicalReplicationOptions
- Returns:
- list options that will be pass to output_plugin for that was create replication slot
-
getStatusInterval
public int getStatusInterval()Description copied from interface:CommonOptions
Specifies the number of millisecond between status packets sent back to the server. This allows for easier monitoring of the progress from server. A value of zero disables the periodic status updates completely, although an update will still be sent when requested by the server, to avoid timeout disconnect. The default value is 10 seconds.- Specified by:
getStatusInterval
in interfaceCommonOptions
- Returns:
- the current status interval
-