AppFacet Actions
In AppFacet an Action represents:
- Triggering an external non-thing event like sending an email, Tweet, triggering a build etc.
- Receiving data from external sources such as a database update
Here are some examples:
Send an Email
# Action(Name: "EmailAction", documentation: "Send Email"): Workflow(Limit: "1", Live: "1", Timeout: "0"): Task(Name: "Main", while: "true"): Event(Name: "Argument", as: "ActionArgument") Invoke(Name: "ReadValue", waitFor: "Argument", post: "smtp://[%:Event.Argument.Hostname.Value:%]", Hostname: "[%:Event.Argument.Hostname.Value:%]"): Message: Value: Port: [%:Event.Argument.Port.Value:%] Username: [%:Event.Argument.Username.Value:%] Password: [%:Event.Argument.Password.Value:%] From: [%:Event.Argument.From.Value:%] To: [%:Event.Argument.To.Value:%] CC: [%:Event.Argument.CC.Value:%] Subject: [%:Event.Argument.Subject.Value:%] Body: [%:Event.Argument.Body.Value:%] StartTLS: [%:Event.Argument.StartTLS.Value:%]
Start Simulation by Executing External Script
# Action(Name: "StartSimulatorAction", Documentation: "Start the simulator"): Workflow(Limit: "1", Live: "1", Timeout: "-1"): Task(Name: "Main"): StartOsWindows: StartProcess.exe cmd.exe "/K c:\Users\Dev\Documents\atomiton\bitbucket\tqlsimulator\build\install\TQLSimulator\bin\TQLSimulator.bat local -runAsFleetEventsGen eventOptions=10" StartOsUnix: bash config/startupscript.sh StartOsMac: [:CmdOsUnix:] StopOsWindows: TaskKill.exe /PID [%:Output.ActionArgument.currentSimulatorState/Known/text():%] StopOsUnix: kill [%:Output.ActionArgument.currentSimulatorState/Known/text():%] StopOsMac: [:CmdOsUnix:] Event(Name: "Argument", as: "ActionArgument") Invoke(Name: "InvokeScript", waitFor: "ActionArgument", skip-if: "[%:Output.ActionArgument.currentSimulatorState/starts-with(Value, 'off'):%]"): execute: [:Start[:OsTag:]:] Output(Name: "ActionResult"): Value: currentSimulatorState: [%:Invoke/InvokeScript/Message/Value/text():%]