commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Mansfield" <AMans...@globeop.com>
Subject [Commons SCXML] - Parallel states and external invocation. Best practice.
Date Mon, 19 Apr 2010 11:33:49 GMT
Hi,

I am attempting to build a state machine that essentially models my
applications workflow.

To do this I have built a simple custom component invoker that can be
executed from the <invoke/> tag to execute Java code. The
'id.invoke.done' event simply transitions to the next state in the
workflow. The flexibility is required as components will be plugged in
for different configurations to change default behaviour often. 

e.g.

   <state id="s1">
    	<invoke targettype="component_invoker" srcexpr="componentId1"/>
    	<transition event="s1.invoke.done" cond="cond1 != null"
target="s2" />
    	<transition event="s1.invoke.done" target="s3" />
    </state>
    
    <state id="s2">
    	<invoke targettype="component_invoker" srcexpr="componentId2"/>
    	<transition event="s2.invoke.done" target="s3" />
    </state>
	
    <state id="s3" final="true">
    	
    </state>

What I want to do is allow for parallel execution of states which
themselves have the abilty to invoke external code. I.e.

    <state id="s1">
    	<invoke targettype="component_invoker" srcexpr="componentId1"/>
    	<transition event="s1.invoke.done" cond="cond1 != null"
target="s2" />
    	<transition event="s1.invoke.done" target="s3" />
    </state>
    
    <state id="s2">
    	<invoke targettype="component_invoker" srcexpr="componentId2"/>
    	<transition event="s2.invoke.done" target="p1" />
    </state>
	
       	<parallel id="p1">
   		
   		<state id="sub1">
	    	<invoke targettype="component_invoker" src="comp1"/>
	    	<transition event="sub1.invoke.done" target="s3" />
		</state>
	          
	    <state id="sub2">
	    	<invoke targettype="component_invoker" src="comp2"/>
	    	<transition event="sub2.invoke.done" target="s3" />
	    </state>

	    <transition event="p1.done" target="s3" />

   	</parallel>

    <state id="s3" final="true">
    	
    </state>

What I can;t seem to work out is how to exit my component invocations
from the substates correctly. Is it event possible to achieve what I am
trying to do or is there a better way to do this ?

Any help would be much appreciated.

Regards,
Andy



--------------------------------------------------------------------------
This email with all information contained herein or attached hereto may contain confidential
and/or privileged information intended for the addressee(s) only. If you have received this
email in error, please contact the sender and immediately delete this email in its entirety
and any attachments thereto.

Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message