Module message_worker::blocking[][src]

Expand description

Listeners that perform CPU intensive/blocking tasks or work with non-threadsafe data

Functions

listen

Creates a listener with the default error handler on its own system thread. It is safe to work with non-sync and non-send data in this listener. The callback (handle_event) will be invoked whenever a new item from the source stream is emitted. The context_factory is a closure you must provide that returns the initial state for the listener.

listen_with_error_handler

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.