? 
scxmlrun reads ,
and then processes 
a sequence of input events listed in 
as instructed in .
Instead of reading from ,
input events can be received over the network via MQTT. 
Output events emitted using SCXML.send
in 
can be 
either written to a local file or transmitted via MQTT. 
- --model 
-  
reads a state-chart in SCXML from 
 
- -i 
-  
read (lines of) SCXML events (in JSON) from 
- -o 
-  
write output events (in JSON) to 
- --trace 
-  
write trace info to .
Trace reports which states execution visits through. 
 
- --mqtt[:in|:out]
-  
assume MQTT-based I/O by default.
 --mqtt:in,
--mqtt:out,
or --mqtt
assumes MQTT for input, output, or both, respectively.
 
- --broker [:]
-  
specifiy 
(at )
as the MQTT broker to connect to.
 (default: localhost:1883)
- --sub 
-  
subscribe to 
for input events.
 multiple topics can be specified as: --sub t1 --sub t2 ...
- --pub 
-  
specify 
as the default topic for output events. 
This is used by SCXML.send
in 
when no topic is passed as a parameter. 
- --trace-pub 
-  
specify 
for publishing trace info 
 
- -r, --relay
-  
run scxmlrun
as a MQTT repeater,
that is, 
scxmlrun
reads input events and transmits them without any interpretation. 
No SCXML model should be specified in this mode. 
 
- -v, --verbose
-  
become verbose. 
- -q, --silent
-  
stay quiet. 
- -V, --version
-  
show version info. 
- -h, --help
-  
show usage. 
 
Consider the following simple SCXML model, which we here call "echo.scxml". 
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" datamodel="ecmascript" initial="q1">
  <state id="q1">
    <transition target="q2" event="echo">
      <script>console.log (_event.data)</script>
    </transition>
  </state>
  <final id="q2"/>
</scxml>
- reading event(s) from a local file 
$ echo '{"event":{"name":"echo","data":"hello"}}' | scxmlrun echo.scxml
 hello
 
 
- reading event(s) via MQTT 
$ scxmlrun echo.scxml --sub echo
 $ mosquitto_pub -t echo -m '{"event":{"name":"echo","data":"hello"}}'
 hello
 
 
Input and output of scxmlrun
are SCXML events in the JSON format.
Each event is a JSON object of the form: 
{"event":{"name":...,...},"type":"mqtt", "topic":..., ...}
See https://www.w3.org/TR/scxml/#send
for the detail. 
Note that, as a scxmlrun-specific
feature, 
"topic"-key and its value can be included in each input/output event, 
which is referred to when connecting to the MQTT broker. 
MQTT_HOST
is looked up, when no broker is explicitly specified. 
rules2scxml 
LDLTools development team at IBM Research. 
(C) Copyright IBM Corp. 2018. 
License Apache 2.0.
This is free software: you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law.