commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul Akolkar <rahul.akol...@gmail.com>
Subject Re: [scxml] Handling condition errors in transitions
Date Tue, 13 Sep 2011 05:24:33 GMT
On Mon, Sep 12, 2011 at 5:17 AM, Dario D <darac1111@gmail.com> wrote:
> Hello,
>
> I have an SCXML workflow as given below. The conditions in the transitions
> of "state2" are invalid because they have an invalid variable name
> "trans-0". The application was made in the way that on each step forward, it
> triggers an "action.next" event, followed by any external events inserted by
> a custom ErrorReporter. This way, the workflow would move to the "_error"
> state on every error. The problem is that on parsing of "state2" transition
> conditions, it did not move to "_error" state. The following sequence
> ocurred:
>
> 1) Workflow follows to "state2"
> 2) Current state is "state2", application triggers an "action.next" event
> 3) ErrorReported inserted two "action.error" events in the queue
> 4) However, the workflow is already in "_end" state (why?)
> 5) Application reads the external events queue, triggers two "action.error"
> events, but nothing happens because workflow is in "_end" state
>
> Why workflow ends up in "_end" state after parsing error?
>
<snip/>

When the state machine is in "state2", there are three candidate
transitions that match event "action.next" -- two with guards in
"state2" and one unguarded or condition-less in state "_processing".
The two in "state2" are not followed, but subsequently the unguarded
one is selected and followed which leads to state "_end". Given state
"_end" is a final state, no further events triggered on the state
machine will have any effect.

-Rahul


> *<scxml xmlns="**http://www.w3.org/2005/07/scxml*<http://www.w3.org/2005/07/scxml>
> *"
>       version="1.0"
>       initialstate="_start">*
> *    <state id="_start">
>        <transition target="_processing" />
>    </state>*
> *    <state id="_processing">*
> *        <initial>
>            <transition target="_actions"/>
>        </initial>*
> *        <history id="_history" type="deep">*
> *        </history>
>
>        <state id="_actions" initial="state1">
>            <state id="state1">
>                <transition event="action.next" target="state2" />
>            </state>*
> *            <state id="state2">
>                <transition event="action.next"
> cond="trans-0.parameter.P_InitialBalance == 7" target="state3" />
>                <transition event="action.next"
> cond="trans-0.parameter.P_InitialBalance == 0" target="state4" />
>            </state>*
> *            <state id="state3">
>                <transition event="action.next" target="state5" />
>            </state>*
> *            <state id="state4">
>                <transition event="action.next" target="state5" />
>            </state>*
> *            <state id="state5">
>            </state>
>        </state>*
> *        <transition event="action.next" target="_end" />*
> *        <transition event="action.end" target="_end"/>*
> *        <transition event="error.*" target="_error" />*
> *    </state>*
> *    <state id="_error">*
> *        <onentry>
>            <log expr="'In error'"/>
>        </onentry>*
> *        <transition event="action.next" target="_history"/>*
> *        <transition event="action.end" target="_end"/>*
> *    </state>*
> *    <state id="_end" final="true">*
> *    </state>*
> *</scxml>*
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message