commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jocke eriksson <jock...@gmail.com>
Subject Re: [SCXML] use the send action.
Date Tue, 04 May 2010 06:23:37 GMT
Ok here is the scenario, send html request to a server, fire event found in
a http response header. What is the recommended way of solving that using
the send tag in scxml. This ugly solution is what i have now.


public final class SendAction extends Send {

    private static final long serialVersionUID = 1L;

    @Override
    public void execute(EventDispatcher evtDispatcher, ErrorReporter errRep,
            SCInstance scInstance, Log appLog, Collection derivedEvents)
            throws ModelException, SCXMLExpressionException {
        scInstance.getRootContext().set("derivedEvents", derivedEvents);
        super.execute(evtDispatcher, errRep, scInstance, appLog,
derivedEvents);
    }

The state is this

    <sc:state id="auth">

        <sc:onentry>
            <ms:send
                namelist="uid pin action"
                targettype="'basichttp'"
                target="'
http://localhost:8080/tms-web-1.3.3/ivr/mediaserver.action'" />
        </sc:onentry>

        <sc:transition event="auth.success" target="vm-play"  />

        <sc:transition event="auth.fail" target="exit" >
            <ms:playaudio value="sp + 'vm-fail_auth.wav'" />
        </sc:transition>

    </sc:state>


But please give me an better option :). If possible without AsyncTrigger


2010/5/3 Rahul Akolkar <rahul.akolkar@gmail.com>

> On Mon, May 3, 2010 at 9:12 AM, jocke eriksson <jocke29@gmail.com> wrote:
> > I have an application that uses many custom actions, but now I'm trying
> to
> > use the dispatchers Send method.
> > My problem is that when I use the executor to trigger events, the machine
> > ends up in an loop.
> > How could one get a reference to the derived events collection from the
> send
> > action, to add events that way.
> <snip/>
>
> The EventDispatcher is meant for <send> and <cancel>, which are part
> of the external communications module. It does not provide ready
> access to the derived events collections, which is the internal state
> of the executing state machine. As you note above, that collection is
> available to custom actions.
>
> However, in v0.9, the semantics of skipping the 'target' and
> 'targettype' (latest WD: now known as 'type') attributes for a <send>
> has the effect of adding the event to the internal events collection
> (latest WD: the type has to be '#_internal' instead of empty or
> missing).
>
> -Rahul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message