Ashwin Phatak
Ashwin Phatak

Reputation: 655

How does Akka ensure actors process only one message at a time

An actor may perform async operations inside the onReceive method, so returning from onReceive doesn't necessarily mean the actor has finished processing the message completely?

How exactly does Akka know when an actor has finished processing the current message, to send it another message to process?

Upvotes: 3

Views: 578

Answers (1)

Ryan
Ryan

Reputation: 7247

An actor will process the next message in its queue as soon as its receive function as returned, regardless of any futures that may be created. If you need to ensure that an actor doesn't process the next message until futures have completed, you'll have to handle that yourself.

Upvotes: 3

Related Questions