Package org.postgresql.replication.fluent.logical

# 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

  `automaticFlush, slotName, startPosition, statusIntervalMs`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LogicalStreamBuilder(StartLogicalReplicationCallback startCallback)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `getAutomaticFlush()`
  `@Nullable String`
  `getSlotName()`
  Required parameter for logical replication.
  `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(String optionName, boolean optionValue)`
  `ChainedLogicalStreamBuilder`
  `withSlotOption(String optionName, int optionValue)`
  `ChainedLogicalStreamBuilder`
  `withSlotOption(String optionName, String optionValue)`
  `ChainedLogicalStreamBuilder`
  `withSlotOptions(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

  `withAutomaticFlush, 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

  `withAutomaticFlush, withSlotName, withStatusInterval`

- ## Constructor Details

  - ### LogicalStreamBuilder

    public LogicalStreamBuilder(StartLogicalReplicationCallback startCallback)
    Parameters:
      `startCallback` - not null callback that should be execute after build parameters for start replication

- ## Method Details

  - ### self

    protected ChainedLogicalStreamBuilder self()
    Specified by:
      `self` in class `AbstractStreamBuilder<ChainedLogicalStreamBuilder>`

  - ### start

    public PGReplicationStream start() throws SQLException
    Description copied from interface: `ChainedLogicalStreamBuilder`
    Open logical replication stream.
    Specified by:
      `start` in interface `ChainedLogicalStreamBuilder`
    Returns:
      not null PGReplicationStream available for fetch data in logical form
    Throws:
      `SQLException` - if there are errors

  - ### getSlotName

    public @Nullable String getSlotName()
    Description copied from interface: `LogicalReplicationOptions`
    Required parameter for logical replication.
    Specified by:
      `getSlotName` in interface `CommonOptions`
    Specified by:
      `getSlotName` in interface `LogicalReplicationOptions`
    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 interface `ChainedCommonStreamBuilder<ChainedLogicalStreamBuilder>`
    Overrides:
      `withStartPosition` in class `AbstractStreamBuilder<ChainedLogicalStreamBuilder>`
    Parameters:
      `lsn` - not null position from which need start replicate changes
    Returns:
      not null fluent

  - ### withSlotOption

    public ChainedLogicalStreamBuilder withSlotOption(String optionName, boolean optionValue)
    Specified by:
      `withSlotOption` in interface `ChainedLogicalStreamBuilder`
    Parameters:
      `optionName` - name of option
      `optionValue` - boolean value
    Returns:
      ChainedLogicalStreamBuilder

  - ### withSlotOption

    public ChainedLogicalStreamBuilder withSlotOption(String optionName, int optionValue)
    Specified by:
      `withSlotOption` in interface `ChainedLogicalStreamBuilder`
    Parameters:
      `optionName` - name of option
      `optionValue` - integer value
    Returns:
      ChainedLogicalStreamBuilder

  - ### withSlotOption

    public ChainedLogicalStreamBuilder withSlotOption(String optionName, String optionValue)
    Specified by:
      `withSlotOption` in interface `ChainedLogicalStreamBuilder`
    Parameters:
      `optionName` - name of option
      `optionValue` - String value
    Returns:
      ChainedLogicalStreamBuilder

  - ### withSlotOptions

    public ChainedLogicalStreamBuilder withSlotOptions(Properties options)
    Specified by:
      `withSlotOptions` in interface `ChainedLogicalStreamBuilder`
    Parameters:
      `options` - properties
    Returns:
      ChainedLogicalStreamBuilder

  - ### getStartLSNPosition

    public LogSequenceNumber getStartLSNPosition()
    Specified by:
      `getStartLSNPosition` in interface `CommonOptions`
    Returns:
      the position to start replication. This cannot be null.

  - ### getSlotOptions

    public 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 interface `LogicalReplicationOptions`
    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 interface `CommonOptions`
    Returns:
      the current status interval

  - ### getAutomaticFlush

    public boolean getAutomaticFlush()
    Specified by:
      `getAutomaticFlush` in interface `CommonOptions`