Module message_worker::blocking
source · Expand description
Listeners that perform CPU intensive/blocking tasks or work with non-threadsafe data
Functions
- 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 thesource
stream is emitted. Thecontext_factory
is a closure you must provide that returns the initial state for the listener. - 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.