Contents
Route to Fetched Targets With Invoking SCXML Strategies
The following SCXML strategy uses the results of a fetch request to construct routing targets.
Fetched files content
- File //myhost/Fetch_1.txt:
{"id":813, "id1":819}
- File //myhost/Fetch_2.txt:
{"id":511, "id1":517}
Root strategy
<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:queue="www.genesyslab.com/modules/queue" xmlns:dialog="www.genesyslab.com/modules/dialog" xmlns:session="www.genesyslab.com/modules/session" xmlns:xi= "http://www.w3.org/2001/XInclude" initial="waitinteraction"> <script> var data1; var data2; </script> <state id="waitinteraction"> <transition event="interaction.added" target="getdata1"/> </state> <state id="getdata1"> <onentry> <session:fetch srcexpr="'http://myhost/Fetch_1.txt'"/> </onentry> <transition event="session.fetch.done" target="getdata2"> <script> data1= JSON.parse(_event.data.content); </script> </transition> <transition event="error.session.fetch" target="error"/> </state> <state id="getdata2"> <onentry> <session:fetch srcexpr="'http://myhost/Fetch_2.txt'"/> </onentry> <transition event="session.fetch.done" target="initial"> <script> data2= JSON.parse(_event.data.content); </script> </transition> <transition event="error.session.fetch" target="error"/> </state> <state id="initial"> <transition cond="_genesys.ixn.interactions[0].userdata['switch']=='1'" target="queued"/> <transition cond="_genesys.ixn.interactions[0].userdata['switch']=='2'" target="queued1"/> </state> <state id="queued"> <onentry> <queue:submit queue="'vq1'" priority="5" timeout="2"> <queue:targets type="skill" statserver="'Single_StatServer'"> <queue:target skillexpr="'switch=1&id>' + data1.id + '&id<' + data1.id1"/> </queue:targets> </queue:submit> </onentry> <transition event="queue.submit.done" target="exit" /> <transition event="error.queue.submit" target="q2.queued" /> </state> <state id="queued1"> <onentry> <queue:submit queue="'vq1'" priority="5" timeout="2"> <queue:targets type="skill" statserver="'Single_StatServer'"> <queue:target skillexpr="'switch=1&id>'+ data2.id + '&id<' + data2.id1"/> </queue:targets> </queue:submit> </onentry> <transition event="queue.submit.done" target="exit" /> <transition event="error.queue.submit" target="q3.queued" /> </state> <xi:include resolved ="q2" href="Inv_Queue_2.xml" xpointer="queued" > <xi:include resolved ="q3" href="Inv_Queue_3.xml" xpointer="queued" > <final id = "exit"/> <final id = "error"/> </scxml>
Strategies making second-chance routing to queues (if first queue:submit failed)
- File //myhost/Inv_Queue_2.xml:
<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:queue="www.genesyslab.com/modules/queue" initial="initial"> <state id="initial" > <transition event="interaction.added" target="queued"/> </state> <state id="queued"> <onentry> <queue:submit queue="'vq1'" priority="5" timeout="100"> <queue:targets type="queue"> <queue:target name="'8112_sw1'"/> </queue:targets> </queue:submit> </onentry> <transition event="queue.submit.done" target="exit" /> <transition event="error.queue.submit" target="error" /> </state> <final id = "exit"/> <final id = "error"/> </scxml>
- File //myhost/Inv_Queue_3.xml:
<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:queue="www.genesyslab.com/modules/queue" initial="initial"> <state id="initial" > <transition event="interaction.added" target="queued"/> </state> <state id="queued"> <onentry> <queue:submit queue="'vq1'" priority="5" timeout="100"> <queue:targets type="queue"> <queue:target name="'8113_sw1'"/> </queue:targets> </queue:submit> </onentry> <transition event="queue.submit.done" target="exit" /> <transition event="error.queue.submit" target="error" /> </state> <final id = "exit"/> <final id = "error"/> </scxml>
This page was last edited on August 14, 2014, at 20:21.
Comments or questions about this documentation? Contact us for support!