I am developing an application that uses Akka, in which Actors are designed to avoid the Request-Response pattern. Using the Extra or the Cameo pattern is possible to model interactions among actors as a "stream" of messages.
The figure below summarizes the architecture of such actors.
The Cameo pattern is implemented to handle the responses coming from SK
actors.
Now, imagine that I want to guarantee the at-least-once semantic between SF
and SK
actors. How can I do that? The implementation of ato semantic using Akka persistence needs the implementation of a Request-Response Pattern between those actors.
How can I ensure an at-least-once semantic between actors that use a Cameo to handle responses?
Thanks a lot
Jamie Allen helps me on Twitter to answer this question. The twitter conversation is this.
I try to summarize the discussion what Jamie said.
So, in this case, the better solution is to remove Akka Persistence completely and reduce the problem to good old message passing.
SF
sends messages toSK
s actors, the Cameo node waits forSK
s responses. If such reactions don't arrive in a predetermined window of time, the Cameo node alertsSF
using a timeout message.SF
resends messages to SKs actors again.The diagram that represents the above solution is the following.
The message in red, marked with number 5, models the timeout message.
As Jamie said:
Hope it helps.