[akka-user] FSM gets a message before a transition finishes?
Hello! I'm not sure if it's possible at all, but if there's a FSM actor A, which is in state S1, then it receives a message M, which triggers a transition to state S2, and in onTransation the actor A sends some messages to another actor B. The actor B process message and sends reply R to sender - actor A. But actor A can handle message of type R only when it's in state S2. So the question is - if actor B sends response R to A *BEFORE *the actor A falls into the state S2 - may it happen than the message will be lost? I never faced such situation, but considering the high loads it is pretty possible to happen. So if there is any way to avoid this - it would be great to know. Thanks in advance! -- Read the docs: http://akka.io/docs/ Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups Akka User List group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
Re: [akka-user] FSM gets a message before a transition finishes?
Hello Eugene, The scenario you have outlined can not happen - you’re safe from this kind of race thanks to the Actor’s properties. The transition as well as calling the transition handlers for the new state are all still happening during Actor A’s receive, which means that it is guaranteed that the state will have changed to S2 before the next message is processed. You can track this flow by looking into FSM.scala and track the flow from receive thorough through processMsg right to makeTransition and handleTransition. If you need more tips let me know — happy hacking! -- Konrad 'ktoso' Malawski hAkker - Typesafe, Inc -- Read the docs: http://akka.io/docs/ Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups Akka User List group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.