Skip to content

Unhandled Messages #3

Description

@ognen

Find a way how an Actor can signal an unhandled message with minimum ceremony.

It is quite common for an actor to ignore messages it is not able to handle at a given moment. This should be handled with minimum ceremony within the receive method. On the other hand if a message has not been handled by an actor, its cell should report it to the dead letters mailbox.

This poses a requirement on the actor's receive method to signal whether a message has been handled or not. The question is how to do it properly.

Akka makes use of Scala's partial functions and the built in syntactic sugar for them to solve this elegantly (the cell can inspect whether the receive method is defined at a certain value).

In Swift we have to be more explicit. Possible solutions:

  • The cell will assume that a message is unhandled unless the receive method explicitly consumes it.
  • The cell will assume that the message is handled unless the recieve methods raises a specific error to signal otherwise
  • The cell doesn't assume anythign. The receive method returns Handled|Unhandled to signal the outcome.

Think about other possibilities (return the message if unhandled, etc...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions