pykka icon indicating copy to clipboard operation
pykka copied to clipboard

Dead letters equivalent?

Open drozzy opened this issue 10 years ago • 1 comments

Is there an equivalent of dead letters in pykka? I.e. ability to see all the message (at least in a log) that were not delivered anywhere?

Currently, I implement this as follows in my actor:

if message.get('command') == 'poll':
        # logic
else:
        logging.log(logging.DEBUG, 'Dead letters: ' + str(message))

drozzy avatar Jul 16 '14 15:07 drozzy

The default implementation of on_receive() in the Actor class will log any unexpected messages on the WARNING log level. If using that, your example could then be updated to:

def on_receive(self, message):
    if message.get('command') == 'poll':
        ... # logic
    else:
        super().on_receive(message)

I'll see if we can improve the docs to include a section on unexpected messages.

jodal avatar Jan 29 '19 21:01 jodal