Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In Atomic Domain Languages an Action is a named XML Element that describes fundamental unit of executable functionality.

 

An  An Action Element can contain following modifiers or attributes:

 

  • Name
  • Documentation

Code Block
languagexml
titleAction Named Element
linenumberstrue
<Action Name="RotateCameraAction" Documentation="Simple Action to Rotate IP-based Camera by x degrees"/> 

...

  • Triggering an external non-thing event like sending an Email, Tweet, triggering a build etc.
  • Receiving data from external source like a Database updates .

 

 

Code Block
languagexml
titleSend an Email
linenumberstrue
<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:%]</Port>
            <Username>[%:Event.Argument.Username.Value:%]</Username>
            <Password>[%:Event.Argument.Password.Value:%]</Password>
            <From>[%:Event.Argument.From.Value:%]</From>
            <To>[%:Event.Argument.To.Value:%]</To>
            <CC>[%:Event.Argument.CC.Value:%]</CC>
            <Subject>[%:Event.Argument.Subject.Value:%]</Subject>
            <Body>[%:Event.Argument.Body.Value:%]</Body>
            <StartTLS>[%:Event.Argument.StartTLS.Value:%]</StartTLS>
          </Value>
        </Message>
      </Invoke>
    </Task>
  </Workflow>
</Action>


 

Code Block
languagexml
titleStart an external Shell Script
linenumberstrue
<Action Name="startSimulatorAc" 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"</StartOsWindows>
      <StartOsUnix>bash config/startupscript.sh</StartOsUnix>
      <StartOsMac>[:CmdOsUnix:]</StartOsMac>
      <StopOsWindows>TaskKill.exe /PID [%:Output.ActionArgument.currentSimulatorState/Known/text():%]</StopOsWindows>
      <StopOsUnix>kill [%:Output.ActionArgument.currentSimulatorState/Known/text():%]</StopOsUnix>
      <StopOsMac>[:CmdOsUnix:]</StopOsMac>
      <Output name="ActionArgument" as="ActionArgument"/>
      <Invoke name="startSimulatorAc" waitFor="ActionArgument" skip-if="[%:Output.ActionArgument.currentSimulatorState/starts-with(Value, 'off'):%]"
        execute="[:Start[:OsTag:]:]">
      </Invoke>
      <Output name="ActionResult">
        <Value>
          <currentSimulatorState>
            [%:Invoke/startSimulatorAc/Message/Value/text():%]
          </currentSimulatorState>
        </Value>
      </Output>
      <Invoke name="stopSimulatorAc" waitFor="ActionArgument" skip-if="[%:Output.ActionArgument.currentSimulatorState/starts-with(Value, 'on'):%]"
        execute="[:Stop[:OsTag:]:]">
      </Invoke>
    </Task>
  </Workflow>
</Action>


How is Action Triggered: Starting of an Action is asynchronous and triggered by external / internal event (change of state).

...