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(); // TODO DBZ-508 get rid of this // Needed by tests when connections are opened and closed in a fast sequence try { Thread.sleep(10); } catch (Exception e) { } stream.forceUpdateStatus(); return stream; }
private void createRplStream() throws SQLException { this.stream = this.rplConnection.getReplicationAPI() .replicationStream() .logical() .withSlotName(this.jdbcConfig.getSlotName()) .withSlotOption("include-xids", true) .withSlotOption("skip-empty-xacts", true) .withStatusInterval(5, TimeUnit.SECONDS) .start(); log.info("GetRplStream success,slot:{}", this.slotName); }
.withSlotName(replicationSlotName) .withSlotOption("include-xids", false) .withStatusInterval(replicationStatusIntervalInMilliseconds, TimeUnit.MILLISECONDS) .withStartPosition(lsn) .start();
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(); // TODO DBZ-508 get rid of this // Needed by tests when connections are opened and closed in a fast sequence try { Thread.sleep(10); } catch (Exception e) { } stream.forceUpdateStatus(); return stream; }