0x5F3759DF
0x5F3759DF

Reputation: 393

Akka message order

According to the Akka documentation (Message Delivery Reliability - General Rules), the message order is preserved for a given sender-receiver pair. The ActorRef.tell(Object msg, ActorRef sender) method allows one to set another actor as the sender of the message. So my question is: Who is the sender in the sender-receiver pair, for which the order is preserved if the sender of the ActorRef.tell is not set to self() but to the ActorRef of another actor?

Which message order guarantees apply, if some code, which is not running in the context of an actor (e.g., interface thread), sends a message to an actor via ActorRef.tell and sets the sender to either ActorRef.noSender() or any other ActorRef?

Upvotes: 4

Views: 1200

Answers (1)

johanandren
johanandren

Reputation: 11479

You could think of sender as sending thread, rather than sender ActorRef, so regardless of what you pass as sender ActorRef the messages will be place in the inbox in the order you called tell in that thread. Other threads doing tell could be sandwiched in any way with the tell calls of your thread, so this is what the sender -> receiver ordering guarantee refers to.

Upvotes: 1

Related Questions