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

pub fn listen_with_error_handler<Ctx, CtxFactory, Source, Event, HandleEventFuture, HandleErrorFuture>(
    source: Source,
    context_factory: CtxFactory,
    handle_event: fn(_: Arc<Ctx>, _: Event) -> HandleEventFuture,
    handle_error: fn(_: Arc<Ctx>, _: Error) -> HandleErrorFuture
) -> JoinHandle<()> where
    Ctx: ThreadSafeContext,
    CtxFactory: FnOnce() -> Ctx + Send + 'static,
    Source: Stream<Item = Event> + Unpin + Send + 'static,
    Event: Send + 'static,
    HandleEventFuture: Future<Output = Result<()>> + Send + 'static,
    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.