On 5/15/06, Nestor Urquiza <[EMAIL PROTECTED]> wrote:
Hello guys,
Could you point me to what you think might be the best
approach here?
I receive a request and pass that request to the scxml
engine by means of triggering the proper event. The
event then put the FSM in an action state where some
internal methods (custom actions) are called.
How could I just suspend the whole execution of the
trigger and go back to the state the application was
before receiving the external event? Right now if an
exception is thrown from a custom action then a new
SCXMLExpressionException(e) is thrown as well so the
FSM stops and therefore the FSM stops at the action
state while of course I want it to go back to the
original state.
<snip/>
This has been asked before, so please allow me to paste just the
relevant bit from an earlier post [1]:
<PASTE>
A more useful mechanism than throwing a Java exception is to catch the
error condition / checked exception and fire a derived error event on
the state machine.
In the <my:action>'s execute() method:
// on error condition or checked exception
derivedEvents.add(new TriggerEvent("err.foo",
TriggerEvent.ERROR_EVENT));
And the SCXML snippet:
<state id="foo">
<onentry>
<my:action ... />
</onentry>
<transition event="err.foo" target="errorstate" />
<!-- other transitions etc. -->
</state>
</PASTE>
This, along with the SCXML <history> element, will get you what you need here.
-Rahul
[1] http://marc.theaimsgroup.com/?l=jakarta-commons-user&m=114344354313954&w=2
Thanks a lot,
Nestor Urquiza
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]