public interface ReplicationStream extends AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
void |
close()
//TODO author=Horia Chiorean date=13/10/2016 description=Don't use this for now, because of the bug from the PG server
This is stream is closed atm.
|
void |
flushLSN()
Sends a message to the server informing it about that latest position in the WAL that this stream has read via
ReplicationConnection.startStreaming() or ReplicationConnection.startStreaming(Long). |
Long |
lastReceivedLSN()
Returns the value for the latest server received LSN during a read operation.
|
PgProto.RowMessage |
read()
Blocks and waits for a Protobuf message to be sent over a replication connection.
|
PgProto.RowMessage |
readPending()
Attempts to read a Protobuf message from a replication connection, returning that message if it's available or returning
null if nothing is available. |
PgProto.RowMessage read() throws SQLException
last received LSN will also be updated accordingly.PgProto.RowMessage instance; this may return null if
the server sends back a message which has already been reported as consumed via the flushLSN() method.SQLException - if anything unexpected failsPGReplicationStream.read()PgProto.RowMessage readPending() throws SQLException
null if nothing is available. Once a message has been received, the value of the last received LSN
will also be updated accordingly.PgProto.RowMessage instance if a message is available and was
written by a server or null if nothing is available from the server or the server sends a message that has
already been reported as consumed via the flushLSN() method.SQLException - if anything unexpected failsPGReplicationStream.readPending()void flushLSN()
throws SQLException
ReplicationConnection.startStreaming() or ReplicationConnection.startStreaming(Long).
This essentially tells the server that this stream has successfully processed messages up to the current read cursor and so the server is free to discard older segments with earlier LSNs. It also affects the catch-up behavior once a slot is restarted and the server attempt to bring it up-to-date.
SQLException - if anything goes wrongLong lastReceivedLSN()
ReplicationConnection.startStreaming() or ReplicationConnection.startStreaming(Long)
methods.Long value, possibly null if this is called before anything has been readvoid close()
throws Exception
close in interface AutoCloseableExceptionPGReplicationStream.close()Copyright © 2017 JBoss by Red Hat. All rights reserved.