Rust

subscription

Module

Subscriptions: the handle callers hold and the state the connection keeps for it.

Contents

use utopia_nats::Subscription;
Rust
pub struct Subscription

A subscription of a [crate::Connection]: what crate::Connection::subscribe returns and the other subscription calls take. Cheap to clone.

use utopia_nats::SubscriptionState;
Rust
pub struct SubscriptionState

The state of a subscription: its callback or its queue of pending messages, its counters and limits.

A subscription with a callback delivers each message to it at once. One without keeps messages until they are taken, up to its pending limits; past them it drops the message and calls the slow-consumer hook once per overflow (again after a message is taken).

Also implements Debug.
Rust
pub type MessageCallback = Box<dyn FnMut(Message) -> Result<(), CallbackError> + Send>

A callback receiving the messages of a subscription.