Skip to main content

ClusterObserver

Trait ClusterObserver 

Source
pub trait ClusterObserver:
    Send
    + Sync
    + Debug {
    // Required methods
    fn on_subscribe(&self, channel: &str, subscriber_pid: u64);
    fn on_unsubscribe(&self, channel: &str, subscriber_pid: u64);
    fn on_publish(&self, channel: &str, envelope: &Envelope);
}
Expand description

Receives channel lifecycle events so an out-of-library clusterer can map them onto distributed process-group membership and cross-node fan-out.

Every method is called from the host thread that drove the originating ChannelHandle operation, AFTER the channel actor has applied it. Implementations must be cheap and non-blocking on the publish path; a slow observer would stall the publishing caller.

Required Methods§

Source

fn on_subscribe(&self, channel: &str, subscriber_pid: u64)

A local subscriber (beamr pid subscriber_pid) joined channel.

Source

fn on_unsubscribe(&self, channel: &str, subscriber_pid: u64)

A local subscriber (beamr pid subscriber_pid) left channel.

Source

fn on_publish(&self, channel: &str, envelope: &Envelope)

A message was published to channel on this node; the observer may fan it out to remote subscribers.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§