public class ReplicationCreateSlotBuilder extends Object implements ChainedCreateReplicationSlotBuilder
Constructor and Description |
---|
ReplicationCreateSlotBuilder(BaseConnection baseConnection) |
Modifier and Type | Method and Description |
---|---|
ChainedLogicalCreateSlotBuilder |
logical()
Get the logical slot builder.
|
ChainedPhysicalCreateSlotBuilder |
physical()
Create physical replication stream for process wal logs in binary form.
|
public ReplicationCreateSlotBuilder(BaseConnection baseConnection)
public ChainedLogicalCreateSlotBuilder logical()
ChainedCreateReplicationSlotBuilder
pgConnection
.getReplicationAPI()
.createReplicationSlot()
.logical()
.withSlotName("mySlot")
.withOutputPlugin("test_decoding")
.make();
PGReplicationStream stream =
pgConnection
.getReplicationAPI()
.replicationStream()
.logical()
.withSlotName("mySlot")
.withSlotOption("include-xids", false)
.withSlotOption("skip-empty-xacts", true)
.start();
while (true) {
ByteBuffer buffer = stream.read();
//process logical changes
}
logical
in interface ChainedCreateReplicationSlotBuilder
public ChainedPhysicalCreateSlotBuilder physical()
ChainedCreateReplicationSlotBuilder
Create physical replication stream for process wal logs in binary form.
Example usage:
pgConnection
.getReplicationAPI()
.createReplicationSlot()
.physical()
.withSlotName("mySlot")
.make();
PGReplicationStream stream =
pgConnection
.getReplicationAPI()
.replicationStream()
.physical()
.withSlotName("mySlot")
.start();
while (true) {
ByteBuffer buffer = stream.read();
//process binary WAL logs
}
physical
in interface ChainedCreateReplicationSlotBuilder
Copyright © 1997-2020 PostgreSQL Global Development Group. All Rights Reserved.