Trait little_stomper::client::ClientFactory
source · pub trait ClientFactory<C: Client>: Sync + Send {
// Required method
fn create<T: AsRef<str>, S: AsRef<str>>(
self,
login: Option<T>,
passcode: Option<S>
) -> Pin<Box<dyn Future<Output = Result<C, StomperError>> + Send + 'static>>;
}
Expand description
A factory which allows creation of a single instance of its parameter type, which must implement Client
.
It passes the the login
and passcode
headers from the stomp_parser::client::ConnectFrame
so that the library user may use them as appropriate.
The expected usage pattern is that the library caller creates a factory initialised based on the transport parameters (e.g. auth settings)
and passes the factors to little-stomper
when the a message stream on that transport ist to be handled by it.
An implementation for functions and closures with the same singature as ClientFactory::create
is provided.