By the way, have you tried to reply (send the reply with ordinary tell / !) andThen? See example in http://doc.akka.io/docs/akka/current/scala/persistence.html#persistent-fsm
On Tue, May 30, 2017 at 2:27 PM, Patrik Nordwall <patrik.nordw...@gmail.com> wrote: > I see what you mean. One way around it is to: > > when(StartedState) { > case Event(..., ...) => > ... > val evt = BidPlaced(...) > val replyData = applyEvent(evt, stateData) > stay applying evt *replying BidPlacedReply(replyData)* > } > > /Patrik > > > On Sat, May 20, 2017 at 6:13 PM, Francois Ferrari <f.ferr...@wanadoo.fr> > wrote: > >> Hi >> >> I'm using akka with PersistentFSM and would like to be able to reply to a >> message using the stateData value after the event has been applied >> >> when(StartedState) { >> case Event(..., ...) => >> ... >> stay applying BidPlaced(...) *replying BidPlacedReply(stateData)* >> } >> >> BidPlacedReply is an object with an apply method that allows to construct >> a BidPlacedReply based on some fields of my stateData, for example I would >> like to be able to reply with a BidPlacedReply containing the current >> highest bidder id, highest bidder price, ... and this values are computed >> in the applyEvent which modifies the state and produces the "stateAfter". >> >> Unfortunatly the "replying BidPlacedReply(stateData)" method calls the >> BidPlacedReply.apply method with the stateData value before the applyEvent >> has been applied (that's what I see in my logs), >> >> How can I reply with the stateData value corresponding to the result of >> the applyEvent (o the stateData "after") ? >> >> >> >> -- >> >>>>>>>>>> Read the docs: http://akka.io/docs/ >> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/c >> urrent/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 https://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > > Patrik Nordwall > Akka Tech Lead > Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM > Twitter: @patriknw > > -- Patrik Nordwall Akka Tech Lead Lightbend <http://www.lightbend.com/> - Reactive apps on the JVM Twitter: @patriknw -- >>>>>>>>>> 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 https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.