Skip to main content

Subscriber

Trait Subscriber 

Source
pub trait Subscriber: Send + Sync {
    // Required method
    fn subscribe(
        &self,
        subject: &str,
    ) -> BoxFuture<'static, Result<Subscription>>;
}
Expand description

Subscriber trait for receiving messages from subjects.

Subscribers receive messages published to matching subjects. Subject patterns support wildcards:

  • * matches a single token (e.g., foo.*.bar)
  • > matches one or more tokens at the tail (e.g., foo.>)

Required Methods§

Source

fn subscribe(&self, subject: &str) -> BoxFuture<'static, Result<Subscription>>

Subscribe to a subject pattern, returning a message stream.

The returned stream yields messages as they arrive. The subscription remains active until the stream is dropped.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§