Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.85 KB

File metadata and controls

47 lines (33 loc) · 1.85 KB

State Machines Interface

Triggerflow provides an interface to orchestrate state machines using events and triggers.

The state machines are defined in Amazon States Language, so we can orchestrate existing state machine definitions proved and running on Amazon Step Functions.

However, this implementation comes with some caveats:

  • Only Lambda tasks are permitted since they can produce termination events through Lambda Destinations.
  • Wait states are not supported, as Triggerflow currently lacks a time-based event source.

Here you can find an example of a toy state machine that combines Choice, Parallel and Map states to test the state machine interface with a complex workflow.

Screenshot_20200702_110036

Instructions to execute the example State Machine

  1. Deploy the functions provided on Lambda.

  2. Replace the deployed functions ARN on the state machine definition file (sm.json).

  3. Have a Triggerflow instance up and running. You can find instructions here.

  4. Run the following commands.

    To deploy the state machine execute:

    triggerflow statemachine deploy examples/state-machine-example/mixed.json
    

    This will give you a run ID. To trigger the state machine deployment execute:

    triggerflow statemachine trigger <RUN_ID>
    

    Where <RUN_ID> is the previously generated run ID.

  5. (Optional) Alternatively, you can deploy and run a state machine using the functions provided directly from a script:

    import json
    
    from triggerflow.statemachine import StateMachine
    
    sm = StateMachine.json('statemachine.json')
    sm.trigger()