Stefan Pinson
Stefan Pinson

Reputation: 1

Enforcing ordered communication between actors

I have a problem which requires my actors to process messages in the order they were sent. In Akka, messages between actor A and actor B are always guaranteed to arrive in the order sent. This does not appear to be the case in Reliable Actors in Service Fabric. In my test cases, the messages are received in non-deterministic order.

I can force ordering by not sending the next message until the first message is processed, but this defeats the entire point. I really want to send and forget the messages, but know that they will be processed in order by the receiving actor.

Has anyone seen a pattern for doing this? I think Orleans Actors has the same out of order message possibility. Perhaps an Orleans solution would work here as well.

Upvotes: 0

Views: 393

Answers (1)

Richard Astbury
Richard Astbury

Reputation: 2363

Orleans does not guarantee the order of message deliver to actors (unless you send them one at a time as you have already discounted):

https://github.com/akka/akka-meta/blob/master/ComparisonWithOrleans.md#messaging-guarantees

However, it is possible to control ordering if you're using streams in Orleans (with the correct underlying stream provider):

http://dotnet.github.io/orleans/Orleans-Streams/

Upvotes: 4

Related Questions