Perhaps you can take a peek at the new state before you decide by using
applyEvent(BidPlaced(...), stateData) match {...
/Patrik
On Wed, May 17, 2017 at 10:16 PM, Francois Ferrari <[email protected]>
wrote:
> Hi All,
>
> I'm using Akka Actors and PersistenceFSM (2.5.1) to develop an Auction
> program.
>
> I would like to be able to apply an Event and change the state depending
> on the NEW state data, something like this :
>
> apply BidPlaced(...) {
> case ActiveAuction(auction) if auction.stock == 0 => goto(Closed)
> case _ => stay ...
> }
>
> I thought I could use andThen to do something like this unfortunatly
> andThen blocks and not rerun during recovery
>
> andThen {
> case ActiveAuction(auction) if auction.stock == 0 =>
> goto(Closed)
> }
>
> Or should I use andThen to send a Close event to myself ? In that case how
> can I ensure that no other events in the queue would be processed before my
> Close event ?
>
> Any advice would be welcome,
>
> --
> >>>>>>>>>> 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 [email protected].
> To post to this group, send email to [email protected].
> 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
--
>>>>>>>>>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.