public class ReplicationStreamBuilder extends java.lang.Object implements ChainedStreamBuilder
| Constructor and Description |
|---|
ReplicationStreamBuilder(BaseConnection connection) |
| Modifier and Type | Method and Description |
|---|---|
ChainedLogicalStreamBuilder |
logical()
Create logical replication stream that decode raw wal logs by output plugin to logical form.
|
ChainedPhysicalStreamBuilder |
physical()
Create physical replication stream for process wal logs in binary form.
|
public ReplicationStreamBuilder(BaseConnection connection)
connection - not null connection with that will be associate replicationpublic ChainedLogicalStreamBuilder logical()
ChainedStreamBuilderExample usage:
PGReplicationStream stream =
pgConnection
.getReplicationAPI()
.replicationStream()
.logical()
.withSlotName("test_decoding")
.withSlotOption("include-xids", false)
.withSlotOption("skip-empty-xacts", true)
.start();
while (true) {
ByteBuffer buffer = stream.read();
//process logical changes
}
logical in interface ChainedStreamBuilderpublic ChainedPhysicalStreamBuilder physical()
ChainedStreamBuilderExample usage:
LogSequenceNumber lsn = getCurrentLSN();
PGReplicationStream stream =
pgConnection
.getReplicationAPI()
.replicationStream()
.physical()
.withStartPosition(lsn)
.withSlotName("test_decoding")
.withSlotOption("include-xids", false)
.withSlotOption("skip-empty-xacts", true)
.withStatusInterval(5, TimeUnit.SECONDS)
.withAutomaticFlush(true)
.start();
while (true) {
ByteBuffer buffer = stream.read();
//process binary WAL logs
}
physical in interface ChainedStreamBuilderCopyright © 2025 PostgreSQL Global Development Group. All rights reserved.