Dear Rahul, dear all, I'd like to use global targetless transitions to handle events occurring asynchronously without leaving the context of the current state. Thus common business logic (executable content within the transition) is inherited or overwritten locally by any substate. It allows for chaining via send/transition pipes for more complex, conditional behaviour. Since the transitions are defined in a different, global scope, data are passed either via global datamodels or via the implicit event payload. My use case is a state machine, where some events should by handled without the "side effect" of triggerring a state transition (the main execution path) asynchronously as they arrive from multiple clients interacting with the SCXML session (e.g. error handling, views on datamodel and current status ...)
I encounter problems when trying to send and evaluate the event payload. There seems to be no _eventdata available within the transition handling the event "view", although the parameter "text" is obviously declared. This code is run with Commons SCXML v0.9: <scxml initialstate="main" version="1.0" xmlns="http://www.w3.org/2005/07/scxml"> <state id="main"> <initial> <transition target="sub1" /> </initial> <datamodel> <data id="text" expr="'TEXT MESSAGE'"></data> </datamodel> <!-- event handler processing the event payload without performing a transition --> <transition event="view"> <log expr="'viewing text message: '"/> <log expr="_eventdata"/> <log expr="text"/> <!-- chained handler --> <if cond="_eventdata == null"><send event="'view_specific'"/></if> </transition> <transition event="view_specific"> <log expr="'no _eventdata found'"/> </transition> <state id="sub1" final="true"> <onentry> <log expr="'sending text message: '+text"/> <send event="'view'" namelist="text" /> </onentry> </state> </state> </scxml> It produces the following log statements: Dec 29, 2008 10:42:12 AM org.apache.commons.scxml.env.SimpleSCXMLListener onEntry INFO: /main Dec 29, 2008 10:42:12 AM org.apache.commons.scxml.model.Log execute INFO: null: sending text message: TEXT MESSAGE Dec 29, 2008 10:42:12 AM org.apache.commons.scxml.env.SimpleSCXMLListener onEntry INFO: /main/sub1 Dec 29, 2008 10:42:12 AM org.apache.commons.scxml.model.Log execute INFO: null: viewing text message: Dec 29, 2008 10:42:12 AM org.apache.commons.scxml.model.Log execute INFO: null: null Dec 29, 2008 10:42:12 AM org.apache.commons.scxml.model.Log execute INFO: null: TEXT MESSAGE Dec 29, 2008 10:42:12 AM org.apache.commons.scxml.env.SimpleSCXMLListener onTransition INFO: transition (event = view, cond = null, from = /main, to = /main) Dec 29, 2008 10:42:12 AM org.apache.commons.scxml.model.Log execute INFO: null: no _eventdata found Dec 29, 2008 10:42:12 AM org.apache.commons.scxml.env.SimpleSCXMLListener onTransition INFO: transition (event = view_specific, cond = null, from = /main, to = /main) It's probably my fault using a wrong syntax. Could you please suggest a way how to: 1) access the simple string content of _eventdata ? 2) access XML _eventdata via XPath ? 3) send a subtree of an XML data model along with an event ? To handle 3) and transition chaines passing arbitrary data chunks via named parameters the <send> element, like <invoke>, could use <param> child elements to explicitly declare its data interface decoupled from the datamodel ? Is there any reason <event>, unlkike <send>, does not support any sort of parametrization in the current WD and such the event name itself has to encode the respective parameter-value information ? Many thanks for your support Jaro --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org