The OrderManager workflow is deployed with the initial core setup. It is triggered by an API call from the front-end applications. It persists updates to the order entry in the serverlesspresso-order-table in DynamoDB. It also retrieves the current TaskToken
and resumes the orderProcessor
workflow.
The OrderManager workflow handles 4 different tasks:
The workflow path is initially decided by a Choice state which queries the $.action
field, and branches accordingly. This is shown below:
Resume the OrderProcessor workflow by running the OrderManager workflow:
Go to the Step Functions console. From the AWS Management Console, select Services then select Step Functions under Application Integration. Make sure your region is correct.
Select State machines from the left panel, then choose OrderManagerStateMachine. Choose Start execution.
Enter the following into the Input text area and choose Start execution:
{"action":"","body":{"userId":"1","drink":"Cappuccino","modifiers":[],"icon":"barista-icons_cappuccino-alternative"},"orderId":"1","baristaUserId":"3"}
See how has affected the OrderProcessor workflow:
The TaskToken
has been used to send a ‘TaskSuccess’ call to the OrderProcessor. The workflow has resumed and progressed to the next wait step.
This was done by the Resume Order Processor step.
See what happens if an item is ordered that is not on the menu:
{"action":"","body":{"userId":"1","drink":"milkshake","modifiers":[],"icon":"barista-icons_cappuccino-alternative"},"orderId":"1","baristaUserId":"3"}
This input payload includes a drink that is not available on the menu "drink":"milkshake"
.
The workflow takes a different execution path from the Is Order Valid? state, and so the order is not entered into the serverlesspresso-order-table.