Skip to main content

PersistentSubscriptionListener

Trait PersistentSubscriptionListener 

Source
pub trait PersistentSubscriptionListener: Send + 'static {
    // Provided methods
    fn on_live_joined(&self) { ... }
    fn on_live_left(&self) { ... }
    fn on_error(&self, error_code: i32, error_message: &str) { ... }
}
Expand description

Trait for persistent subscription event listeners. This provides a safe Rust alternative to using raw C function pointers.

In the poll loop, prefer the state queries is_live() / is_replaying() / has_failed() for control flow and treat this listener as observational (logging/metrics). See Aeron’s PersistentSubscriptionListener.

Provided Methods§

Source

fn on_live_joined(&self)

Called when the persistent subscription transitions to consuming from the live stream. Can fire more than once: if the live image is lost the subscription falls back to replay and this fires again on rejoin.

Source

fn on_live_left(&self)

Called when the persistent subscription stops consuming from the live stream (e.g. the live image closed). The subscription automatically falls back to replay; no user action required. Can fire repeatedly.

Source

fn on_error(&self, error_code: i32, error_message: &str)

Called for both non-terminal and terminal errors. Non-terminal errors (timeouts, transient resource unavailability) are retried automatically. A terminal failure flips AeronArchivePersistentSubscription::has_failed to true — check it in the poll loop and read the reason with AeronArchivePersistentSubscription::get_failure_reason.

Implementors§