Skip to main content

ConsumerLifecycle

Trait ConsumerLifecycle 

Source
pub trait ConsumerLifecycle: Send + Sync {
    // Required methods
    async fn start(&self) -> ClientResult<()>;
    async fn shutdown(&self);
    async fn is_running(&self) -> bool;
}

Required Methods§

Source

async fn start(&self) -> ClientResult<()>

Starts the consumer and establishes connections to the broker and name server.

This function does not block the calling thread.

§Errors

Returns an error if the consumer is already running, if required configuration is invalid, or if the connection to the name server cannot be established.

Source

async fn shutdown(&self)

Shuts down the consumer and releases all associated resources.

This function does not block the calling thread. After shutdown, the consumer cannot be restarted.

Source

async fn is_running(&self) -> bool

Returns whether the consumer is currently in the running state.

This function does not block the calling thread.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§