public interface ReplicationStream extends AutoCloseable
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ReplicationStream.ReplicationMessageProcessor |
| 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(long lsn)
Sends a message to the server informing it about that latest position in the WAL that has successfully been
processed.
|
Long |
lastReceivedLsn()
Returns the value for the latest server received LSN during a read operation.
|
void |
read(ReplicationStream.ReplicationMessageProcessor processor)
Blocks and waits for a replication message to be sent over a replication connection.
|
boolean |
readPending(ReplicationStream.ReplicationMessageProcessor processor)
Attempts to read a replication message from a replication connection, processing that message if it's available or returning
false if nothing is available. |
void |
startKeepAlive(ExecutorService service)
Starts a background thread to ensure the slot is kept alive, useful for when temporarily
stopping reads from the stream such as querying metadata, etc
|
void |
stopKeepAlive()
Stops the background thread that is used to ensure the slot is kept alive.
|
void read(ReplicationStream.ReplicationMessageProcessor processor) throws SQLException, InterruptedException
last received LSN will also be updated accordingly.processor - - a callback to which the arrived message is passedSQLException - if anything unexpected failsInterruptedExceptionPGReplicationStream.read()boolean readPending(ReplicationStream.ReplicationMessageProcessor processor) throws SQLException, InterruptedException
false if nothing is available. Once a message has been received, the value of the last received LSN
will also be updated accordingly.processor - - a callback to which the arrived message is passedtrue if a message was received and processedSQLException - if anything unexpected failsInterruptedExceptionPGReplicationStream.readPending()void flushLsn(long lsn)
throws SQLException
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 startKeepAlive(ExecutorService service)
void stopKeepAlive()
void close()
throws Exception
close in interface AutoCloseableExceptionPGReplicationStream.close()Copyright © 2019 JBoss by Red Hat. All rights reserved.