Function message_worker::non_blocking::listen_with_error_handler[][src]

pub fn listen_with_error_handler<Ctx, CtxFactory, Source, Message, HandleMessageFuture, HandleMessageErrorT, HandleErrorFuture>(
    source: Source,
    context_factory: CtxFactory,
    handle_message: fn(_: Arc<Ctx>, _: Message) -> HandleMessageFuture,
    handle_error: fn(_: Arc<Ctx>, _: Error) -> HandleErrorFuture
) -> JoinHandle<()> where
    Ctx: Send + Sync + 'static,
    CtxFactory: FnOnce() -> Ctx + Send + 'static,
    Source: Stream<Item = Message> + Unpin + Send + 'static,
    Message: Send + 'static,
    HandleMessageFuture: Future<Output = Result<Option<Ctx>, HandleMessageErrorT>> + Send + 'static,
    HandleMessageErrorT: Into<Error> + Send,
    HandleErrorFuture: Future<Output = bool> + Send + 'static, 
Expand description

This is the same as listen but it allows a custom error handler to be defined. The error handler callback receives the context of the listener and the error that occurred. The error handler callback returns a boolean declaring if the listener should keep running or not.