Skip to main content

recv

Function recv 

Source
pub async fn recv(
    duplex: &mut Duplex,
) -> Result<Option<ReplicationEvent>, FaucetError>
Available on crate features source-postgres-cdc and source-rest only.
Expand description

Receive the next meaningful replication event from the server.

Returns:

ReplicationEvent::KeepAlive events are absorbed here. We deliberately do not advance the applied-LSN to the server’s wal_end on a keepalive (the previous behaviour): that position is not yet durable downstream, and advertising it as confirmed_flush_lsn would authorise Postgres to recycle WAL for changes the consumer never persisted — a crash in that window loses data (#78/#1). The applied-LSN is advanced only from the durable bookmark, via send_status_update at the start of each run; the library keeps sending its periodic Standby Status Updates (carrying that durable position) to hold the connection open. ReplicationEvent::StoppedAt is converted to Ok(None).