@NotThreadSafe public interface ReplicationConnection extends AutoCloseable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ReplicationConnection.Builder
A builder for
ReplicationConnection |
| Modifier and Type | Method and Description |
|---|---|
static ReplicationConnection.Builder |
builder(Configuration jdbcConfig)
Creates a new
ReplicationConnection.Builder instance which can be used for creating replication connections. |
static String |
format(long lsn)
Formats a LSN long value as a String value which can be used for outputting user-friendly LSN values.
|
boolean |
isConnected()
Checks whether this connection is open or not
|
ReplicationStream |
startStreaming()
Opens a stream for reading logical replication changes from the last known position of the slot for which the connection
was opened.
|
ReplicationStream |
startStreaming(Long offset)
Opens a stream for reading logical replication changes from a given LSN position.
|
closeReplicationStream startStreaming() throws SQLException
confirmed_flush_lsn value from the pg_replication_slots
table.
If there is no "last known value" (i.e. the connection is for a newly created slot) then the Postgres server will start streaming changes from that last position reported during this connection's creation.
PGReplicationStream from which data is read; never nullSQLException - if there is a problem obtaining the replication streamReplicationStream startStreaming(Long offset) throws SQLException
Note that it is possible for a server to have recycled old WAL segments (see the wal_keep_segments setting). If
that is the case, then even though a LSN number may be valid, the server will not stream back any changes because they
are not available.
offset - a value representing the WAL sequence number where replication should start from; if the value
is null or negative, this behaves exactly like startStreaming().PGReplicationStream from which data is read; never nullSQLException - if anything failsLogSequenceNumberboolean isConnected()
throws SQLException
true if this connection is open, false otherwiseSQLException - if anything unexpected failsstatic ReplicationConnection.Builder builder(Configuration jdbcConfig)
ReplicationConnection.Builder instance which can be used for creating replication connections.jdbcConfig - a Configuration instance that contains JDBC settings; may not be nullstatic String format(long lsn)
lsn - the LSN valuenullCopyright © 2017 JBoss by Red Hat. All rights reserved.