You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Antonio Toma <an...@ericsson.com> on 2009/04/09 15:11:36 UTC

Problem with persisted SCXML

Hi,

I'm trying to set up a stateful application with the following pattern:

1) Create an SCXML object with custom actions from an XML string, and
serialize it to a DB.
2) when a start event arrives, read the SCXML from 1), create an
SCXMLExecutor and write it to a DB.
3) when an intermediate event arrives, read the SCXMLExecutor from 2)
and trigger the intermediate event on it
4) if SCXMLExecutor.getCurrentStatus.isFinal() == false, write it back
to the DB else goto 5)
5) remove the SCXMLExecutor and goto 2)

Now I have two questions:

1) Is there any example available I can use as a guideline?
2) In my first attempts it seems like custom actions are lost after
persisting the SCXML to the DB
(I mean that if I serialize the SCXML I read from DB and compare it to
the original one, it is missing the actions I put in the <transition>
tags). Any special direction for persisting an SCXML with custom
actions?

Any help appreciated.

Thank you and regards.
Antonio.

Re: Problem with persisted SCXML

Posted by Rahul Akolkar <ra...@gmail.com>.
On Thu, Apr 9, 2009 at 9:11 AM, Antonio Toma <an...@ericsson.com> wrote:
> Hi,
>
> I'm trying to set up a stateful application with the following pattern:
>
> 1) Create an SCXML object with custom actions from an XML string, and
> serialize it to a DB.
> 2) when a start event arrives, read the SCXML from 1), create an
> SCXMLExecutor and write it to a DB.
> 3) when an intermediate event arrives, read the SCXMLExecutor from 2)
> and trigger the intermediate event on it
> 4) if SCXMLExecutor.getCurrentStatus.isFinal() == false, write it back
> to the DB else goto 5)
> 5) remove the SCXMLExecutor and goto 2)
>
<snip/>

Seems reasonable.


> Now I have two questions:
>
> 1) Is there any example available I can use as a guideline?
<snap/>

We have JUnit tests that do such serialization round-trips (see in
SCXMLTestHelper.java buried under src/test/java/). Its standard
serialization stuff.


> 2) In my first attempts it seems like custom actions are lost after
> persisting the SCXML to the DB
> (I mean that if I serialize the SCXML I read from DB and compare it to
> the original one, it is missing the actions I put in the <transition>
> tags). Any special direction for persisting an SCXML with custom
> actions?
<snip/>

If you're using the SCXMLSerializer class, it doesn't serialize custom
actions. Perhaps it could toString() custom actions in place but that
will require authors produce well-formed markup there.

If you are noticing unexpected functional changes, we will need more details.

-Rahul


>
> Any help appreciated.
>
> Thank you and regards.
> Antonio.
>

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