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