use of org.postgresql.replication.fluent.logical.ChainedLogicalStreamBuilder in project debezium by debezium.
the class PostgresReplicationConnection method startPgReplicationStream.
private PGReplicationStream startPgReplicationStream(final LogSequenceNumber lsn, Function<ChainedLogicalStreamBuilder, ChainedLogicalStreamBuilder> configurator) throws SQLException {
assert lsn != null;
ChainedLogicalStreamBuilder streamBuilder = pgConnection().getReplicationAPI().replicationStream().logical().withSlotName(slotName).withStartPosition(lsn);
streamBuilder = configurator.apply(streamBuilder);
if (statusUpdateIntervalMillis != null && statusUpdateIntervalMillis > 0) {
streamBuilder.withStatusInterval(statusUpdateIntervalMillis, TimeUnit.MILLISECONDS);
}
PGReplicationStream stream = streamBuilder.start();
// Needed by tests when connections are opened and closed in a fast sequence
try {
Thread.sleep(10);
} catch (Exception e) {
}
stream.forceUpdateStatus();
return stream;
}
Aggregations