Skip to main content

SessionFactory

Trait SessionFactory 

Source
pub trait SessionFactory: Send + Sync {
    // Required method
    fn create(&self) -> Box<dyn MessageHandler>;
}
Available on crate feature channels only.
Expand description

Session factory — creates new MessageHandler instances.

Called whenever a new session is needed, returning a brand new MessageHandler. Users typically create an Agent inside a closure and wrap it as a MessageHandler.

Required Methods§

Source

fn create(&self) -> Box<dyn MessageHandler>

Create a new message handler (new session)

Implementors§

Source§

impl<F> SessionFactory for F
where F: Fn() -> Box<dyn MessageHandler> + Send + Sync,

Closure-based SessionFactory implementation