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
Constructors Constructor Description LogicalStreamBuilder(StartLogicalReplicationCallback startCallback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getSlotName()
Required parameter for logical replication.java.util.Properties
getSlotOptions()
Parameters for output plugin.LogSequenceNumber
getStartLSNPosition()
int
getStatusInterval()
Specifies the number of millisecond between status packets sent back to the server.protected ChainedLogicalStreamBuilder
self()
PGReplicationStream
start()
Open logical replication stream.ChainedLogicalStreamBuilder
withSlotOption(java.lang.String optionName, boolean optionValue)
ChainedLogicalStreamBuilder
withSlotOption(java.lang.String optionName, int optionValue)
ChainedLogicalStreamBuilder
withSlotOption(java.lang.String optionName, java.lang.String optionValue)
ChainedLogicalStreamBuilder
withSlotOptions(java.util.Properties options)
ChainedLogicalStreamBuilder
withStartPosition(LogSequenceNumber lsn)
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 Detail
-
LogicalStreamBuilder
public LogicalStreamBuilder(StartLogicalReplicationCallback startCallback)
- Parameters:
startCallback
- not null callback that should be execute after build parameters for start replication
-
-
Method Detail
-
self
protected ChainedLogicalStreamBuilder self()
- Specified by:
self
in classAbstractStreamBuilder<ChainedLogicalStreamBuilder>
-
start
public PGReplicationStream start() throws java.sql.SQLException
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:
java.sql.SQLException
- if there are errors
-
getSlotName
public java.lang.String 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
public ChainedLogicalStreamBuilder withStartPosition(LogSequenceNumber lsn)
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
public ChainedLogicalStreamBuilder withSlotOption(java.lang.String optionName, boolean optionValue)
- Specified by:
withSlotOption
in interfaceChainedLogicalStreamBuilder
- Parameters:
optionName
- name of optionoptionValue
- boolean value- Returns:
- ChainedLogicalStreamBuilder
-
withSlotOption
public ChainedLogicalStreamBuilder withSlotOption(java.lang.String optionName, int optionValue)
- Specified by:
withSlotOption
in interfaceChainedLogicalStreamBuilder
- Parameters:
optionName
- name of optionoptionValue
- integer value- Returns:
- ChainedLogicalStreamBuilder
-
withSlotOption
public ChainedLogicalStreamBuilder withSlotOption(java.lang.String optionName, java.lang.String optionValue)
- Specified by:
withSlotOption
in interfaceChainedLogicalStreamBuilder
- Parameters:
optionName
- name of optionoptionValue
- String value- Returns:
- ChainedLogicalStreamBuilder
-
withSlotOptions
public ChainedLogicalStreamBuilder withSlotOptions(java.util.Properties options)
- Specified by:
withSlotOptions
in interfaceChainedLogicalStreamBuilder
- Parameters:
options
- properties- Returns:
- ChainedLogicalStreamBuilder
-
getStartLSNPosition
public LogSequenceNumber getStartLSNPosition()
- Specified by:
getStartLSNPosition
in interfaceCommonOptions
- Returns:
- the position to start replication. This cannot be null.
-
getSlotOptions
public java.util.Properties 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
-
-