happyly.handling.dummy_handler._DummyHandler

class happyly.handling.dummy_handler._DummyHandler

Bases: happyly.handling.handler.Handler

handle(message)

Applies logic using a provided message, optionally gives back one or more results.

on_handling_failed(message, error)

Applies fallback logic using a provided message when handle() fails, optionally gives back one or more results.

handle(message)

Applies logic using a provided message, optionally gives back one or more results. Each result consists of message attributes which can be serialized and sent. When fails, calls on_handling_failed()

Parameters

message (Mapping[str, Any]) – A parsed message as a dictionary of attributes

Returns

None if no result is extracted from handling, a dictionary of attributes for single result

on_handling_failed(message, error)

Applies fallback logic using a provided message when handle() fails, optionally gives back one or more results. Enforces users of Handler class to provide explicit strategy for errors.

If you want to propagate error further to the underlying Executor/Handler, just re-raise an error here:

def on_handling_failed(self, message, error):
    raise error
Parameters
Returns

None if no result is extracted from handling, a dictionary of attributes for single result