Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message Order Guaranteed? #140

Open
jbabyhacker opened this issue Nov 24, 2020 · 3 comments
Open

Message Order Guaranteed? #140

jbabyhacker opened this issue Nov 24, 2020 · 3 comments

Comments

@jbabyhacker
Copy link

If you have a system with two actors, A and B. Actor A is repeatedly sending messages very quickly to Actor B. Will Actor B always receive the messages in the same order Actor A sent them? For example, sending messages 1,2,3,4,5 from Actor A to Actor B where 1 is sent first and 5 is sent last. Does Riker guarantee Actor B to receive 1,2,3,4,5 and not 1,2,4,3,5?

@hardliner66
Copy link
Contributor

In the current implementation messages should always arrive in the order they are sent. But, if I understand correctly, Riker (the project) itself does not guarantee any messaging order, which means that you should not rely on a guaranteed message order because it could change in the future.

Maybe @leenozara can say a bit more about this topic.

For the future it would be nice if we could provide this guarantee, so that people can rely on causal message ordering.

@jbabyhacker
Copy link
Author

Thanks. I'm glad the order is maintained in the current implementation. I would be nice if the project would consider providing this guarantee.

@leenozara
Copy link
Contributor

leenozara commented Dec 2, 2020

Message order is guaranteed by sender-receiver pair. Messages sent by ActorA to ActorB will not be received out of order. This is implicit from guarantees 2 and 3 in https://riker.rs/actors/#message-guarantees. I.e. An actor instance handles only one message at a time, so it can only place a message on a receiving actor's mailbox one at a time. Actors process the messages in the order they are received.

This only applies to user-level messages. System messages are processed ahead of user messages, but they too are processed in the order they are received.

Riker message guarantees are per Actor System (local only). We will keep these guarantees but they won't be extended to remote systems when we introduce remoting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants