I tried to reproduce your problem, but I cannot see any problems with the
predicate not being honoured. Here's a gist with what I did to reproduce
it: https://gist.github.com/johanandren/7d01d19211867df0c308ba5fb1294162

--
Johan
Akka Team



On Mon, Apr 24, 2017 at 10:35 AM, Ankit Thakur <ankit...@gmail.com> wrote:

> Hi Guys,
>
> I have implemented a persistent FSM in Java, wherein i am evaluating a
> condition and post the validation of the same i decide to *stay* or *goTo*
> another state. I am a version just before the 2.5.0, so i am not very sure
> if the below mentioned issue is resolved or not.
>
> The issue is that i am not able to evaluate a predicate with *matchEvent *but
> the same works with *.event *construct. Below is a sample of the code.
>
> when(State.A,
>         matchEvent(SomeEvent.class,
>             (someEvent, domainEvent) -> {
>               return ((some condition) ? false : true;
>             }, (someEvent, domainEvent) ->
>         {
>           \* do something here *\
>           return stay().
>           applying(someEvent).
>           andThen(\* do something here *\);
>         }).
>         event((SomeEvent.class,
>             ((someEvent, domainEvent) -> {
>               return (((some condition) ? true : false;
>             }, (someEvent, domainEvent) ->
>         {
>            \* do something here *\
>           return goTo(State.B).
>           applying(someEvent).
>           andThen(\* do something here *\);
>         }));
>
> As mentioned above, the above piece of code does not honor the *condition
> *when coupled with *matchEvent*, but does work in case of *.event*.
>
> when(State.A,
>         matchEvent(HackEventToLetFSMProcessPredicate.class,
>             (hackEventToLetFSMProcessPredicate, domainEvent) -> {
>               return ((some condition) ? false : true;
>             }, (hackEventToLetFSMProcessPredicate, domainEvent) ->
>         {
>           \* do something here *\
>           return stay().
>           applying(someEvent).
>           andThen(\* do something here *\);
>         }).
>         event((SomeEvent.class,
>             ((someEvent, domain) -> {
>               return (((some condition) ? true : false;
>             }, (someEvent, domainEvent) ->
>         {
>            \* do something here *\
>           return stay().
>           applying(someEvent).
>           andThen(\* do something here *\);
>         }).
>         event((SomeEvent.class,
>             ((someEvent, domainEvent) -> {
>               return (((some condition) ? true : false;
>             }, (stateA, someEvent) ->
>         {
>            \* do something here *\
>           return goTo(State.B).
>           applying(someEvent).
>           andThen(\* do something here *\);
>        }
>      ));
>
> Any help or update regarding this issue/bug is highly appreciated.
>
> Regards,
> Ankit
>
> --
> >>>>>>>>>> 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.
>

-- 
>>>>>>>>>>      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.

Reply via email to