Multi-pattern workflow
Build a system of three patterns that compose into an order processing pipeline with validation and business logic.
In this tutorial, you build a system of three patterns that work together as an order processing pipeline. One pattern validates input, another processes the order, and a third orchestrates the entire workflow. This demonstrates the composition model in DRAGOPS — patterns act as functions with typed inputs and outputs, and you can wire them together to build complex systems from simple, reusable parts.
What you will build
Three patterns that form a pipeline:
- Validate Input — receives order data, checks that required fields are present, and returns a validation result
- Process Order — receives validated order data, applies business logic (calculates a total), and returns the processed result
- Order Pipeline — receives a webhook request, calls Validate Input, checks the result, calls Process Order if valid, and responds with the final output
When you send an order to the Order Pipeline webhook, the full flow runs across all three patterns:
Before you begin
Make sure you have:
- An active DRAGOPS account
- Familiarity with creating patterns, wiring nodes, and deploying
- Understanding of pattern composition (see Call patterns from patterns)
Part 1: Build the Validate Input pattern
This pattern receives order data and checks that the required fields (item and quantity) are present. It returns a valid flag and an error message if validation fails.
Step 1: Create the pattern
- Open the DRAGOPS dashboard.
- Select New Pattern.
- Enter the name "Validate Input" and select Create.
Step 2: Add the On Pattern Call trigger
- Remove the default On Start node.
- Right-click on the canvas to open the node search menu.
- Search for "On Pattern Call" and add it to the canvas.
Step 3: Define the input parameters
Select the On Pattern Call node to open the Inspector Panel on the left side. Add two input parameters:
- item (String) — the name of the item being ordered
- quantity (Integer) — the number of items
These appear as output data pins on the On Pattern Call node.
Step 4: Check that item is not empty
- Add an Equal node. Add a String literal with an empty value
""and wire it to Equal's second input pin. Wire On Pattern Call's item output pin to Equal's first input pin. - Add a Branch node. Wire Equal's Result output pin to Branch's Condition input pin.
- Wire the execution flow from On Pattern Call to Branch.
If the item is empty, the Branch's True path fires — this is the invalid case.
Step 5: Return a failure response for missing item
- Add a Respond With node on the True path.
- Select it and add two output parameters: valid (Boolean) and error (String).
- Add a Boolean literal set to
falseand wire it to Respond With's valid input pin. - Add a String literal set to
Item is requiredand wire it to Respond With's error input pin. - Wire the execution flow from Branch's True output pin to this Respond With node.
Step 6: Check that quantity is greater than zero
On the False path (item is not empty), add another validation check.
- Add a Greater Than node. Wire On Pattern Call's quantity output pin to the first input. Add an Integer literal set to
0and wire it to the second input. - Add a Branch node. Wire Greater Than's Result to Branch's Condition input pin.
- Wire the execution flow from the first Branch's False output pin to this second Branch.
Step 7: Return a failure response for invalid quantity
- Add a Respond With node on the second Branch's False path (quantity is not greater than zero).
- Add the same two output parameters: valid (Boolean) and error (String).
- Wire a Boolean literal set to
falseto Respond With's valid input pin. - Wire a String literal set to
Quantity must be greater than zeroto Respond With's error input pin. - Wire the execution flow from the second Branch's False output pin to this Respond With node.
Step 8: Return a success response
- Add a Respond With node on the second Branch's True path (all validation passed).
- Add the same two output parameters: valid (Boolean) and error (String).
- Wire a Boolean literal set to
trueto Respond With's valid input pin. - Wire a String literal with an empty value
""to Respond With's error input pin. - Wire the execution flow from the second Branch's True output pin to this Respond With node.
Step 9: Deploy Validate Input
Select Deploy in the toolbar. This pattern is now live and ready to be called by other patterns.
Part 2: Build the Process Order pattern
This pattern receives validated order data, calculates a total price, and returns the processed result.
Step 1: Create the pattern
- Return to the dashboard and select New Pattern.
- Enter the name "Process Order" and select Create.
Step 2: Add the On Pattern Call trigger
- Remove the default On Start node.
- Right-click on the canvas, search for "On Pattern Call", and add it to the canvas.
Step 3: Define the input parameters
Select the On Pattern Call node and add three input parameters:
- item (String) — the item name
- quantity (Integer) — the number of items
- pricePerUnit (Float) — the unit price
Step 4: Calculate the total
- Add a Multiply node. Wire On Pattern Call's quantity output pin to the first input and pricePerUnit output pin to the second input.
Multiply is a pure node (no execution pins) — it evaluates automatically when its output is needed.
Step 5: Build a confirmation message
- Add a Format node. Set the Template to
Order confirmed: {0} x {1} = ${2}. - Wire On Pattern Call's item output pin to Format's first input.
- Wire On Pattern Call's quantity output pin to Format's second input.
- Wire Multiply's Result output pin to Format's third input.
Step 6: Log and return the result
- Add a Log node. Wire Format's Result output pin to Log's Message input pin.
- Wire the execution flow from On Pattern Call to Log.
- Add a Respond With node. Add three output parameters:
- confirmation (String) — the formatted confirmation message
- total (Float) — the calculated total
- status (String) — the order status
- Wire Format's Result to Respond With's confirmation input pin.
- Wire Multiply's Result to Respond With's total input pin.
- Add a String literal set to
processedand wire it to Respond With's status input pin. - Wire the execution flow from Log to Respond With.
Step 7: Deploy Process Order
Select Deploy in the toolbar.
Part 3: Build the Order Pipeline orchestrator
This pattern ties everything together. It receives a webhook request, calls Validate Input, checks the result, and if valid, calls Process Order and returns the final response.
Step 1: Create the pattern
- Return to the dashboard and select New Pattern.
- Enter the name "Order Pipeline" and select Create.
Step 2: Add the webhook trigger
- Remove the default On Start node.
- Right-click on the canvas, search for "On Webhook", and add it to the canvas.
Step 3: Extract order fields from the request body
- Add a Get Property node. Set the Key to
item. Wire On Webhook's Body output pin to its Object input pin. - Add a Get Property node. Set the Key to
quantity. Wire On Webhook's Body output pin to its Object input pin. - Add a Get Property node. Set the Key to
pricePerUnit. Wire On Webhook's Body output pin to its Object input pin. - Wire the execution flow from On Webhook through each Get Property node in sequence.
Step 4: Call Validate Input
- Right-click on the canvas and search for "Call Pattern".
- Add a Call Pattern node. Select the node and choose "Validate Input" from the Pattern dropdown in the Inspector Panel.
- Wire the
itemGet Property's Value output pin to Call Pattern's item input pin. - Wire the
quantityGet Property's Value output pin to Call Pattern's quantity input pin. - Wire the execution flow from the last Get Property to Call Pattern.
After execution, Call Pattern's output pins (valid and error) contain the validation result.
Step 5: Branch on the validation result
- Add a Branch node. Wire Call Pattern's valid output pin to Branch's Condition input pin.
- Wire the execution flow from Call Pattern to Branch.
Step 6: Handle invalid input
On Branch's False path, return an error response to the caller.
- Add a Set Property node. Set the Key to
error. Wire Call Pattern's error output pin to Set Property's Value input pin. - Add another Set Property node. Set the Key to
status. Add a String literal set torejectedand wire it to the Value input pin. Wire the first Set Property's Object output pin to the second Set Property's Object input pin. - Add a JSON Stringify node. Wire the second Set Property's Object output pin to JSON Stringify's Object input pin.
- Add a Respond To Webhook node. Set the Status Code to
400. - Add a Set Property node for headers. Set the Key to
Content-Typeand wire a String literal set toapplication/jsonto its Value input pin. Wire its Object output to Respond To Webhook's Headers input pin. - Wire JSON Stringify's String output to Respond To Webhook's Body input pin.
- Wire the execution flow from Branch's False output pin through the chain to Respond To Webhook.
Step 7: Call Process Order
On Branch's True path, call the Process Order pattern with the validated data.
- Add a second Call Pattern node. Select "Process Order" from the Pattern dropdown.
- Wire the
itemGet Property's Value output pin to Call Pattern's item input pin. - Wire the
quantityGet Property's Value output pin to Call Pattern's quantity input pin. - Wire the
pricePerUnitGet Property's Value output pin to Call Pattern's pricePerUnit input pin. - Wire the execution flow from Branch's True output pin to this Call Pattern node.
Step 8: Return the processed result
- Add a Set Property node. Set the Key to
confirmation. Wire the Process Order Call Pattern's confirmation output pin to Set Property's Value input pin. - Add another Set Property node. Set the Key to
total. Wire the Process Order Call Pattern's total output pin to its Value input pin. Chain it from the previous Set Property's Object output. - Add another Set Property node. Set the Key to
status. Wire the Process Order Call Pattern's status output pin to its Value input pin. Chain it from the previous Set Property's Object output. - Add a JSON Stringify node. Wire the final Set Property's Object output to JSON Stringify's Object input pin.
- Add a Respond To Webhook node. Set the Status Code to
200. - Add a Set Property node for headers. Set the Key to
Content-Typeand wire a String literal set toapplication/jsonto its Value input pin. Wire its Object output to Respond To Webhook's Headers input pin. - Wire JSON Stringify's String output to Respond To Webhook's Body input pin.
- Wire the execution flow from the Process Order Call Pattern through the chain to Respond To Webhook.
Step 9: Deploy Order Pipeline
Select Deploy in the toolbar. Copy the webhook URL from the Triggers panel.
Step 10: Test the full pipeline
Test with valid input
Send a valid order:
curl -X POST https://your-webhook-url \
-H "Content-Type: application/json" \
-d '{"item": "Widget Pro", "quantity": 3, "pricePerUnit": 29.99}'Expected response:
{
"confirmation": "Order confirmed: Widget Pro x 3 = $89.97",
"total": 89.97,
"status": "processed"
}Test with missing item
curl -X POST https://your-webhook-url \
-H "Content-Type: application/json" \
-d '{"item": "", "quantity": 3, "pricePerUnit": 29.99}'Expected response (HTTP 400):
{
"error": "Item is required",
"status": "rejected"
}Test with invalid quantity
curl -X POST https://your-webhook-url \
-H "Content-Type: application/json" \
-d '{"item": "Widget Pro", "quantity": 0, "pricePerUnit": 29.99}'Expected response (HTTP 400):
{
"error": "Quantity must be greater than zero",
"status": "rejected"
}Step 11: Verify the execution chain
Open the Deployments page and inspect the executions for each pattern:
- Order Pipeline — shows the webhook receipt, the two Call Pattern invocations, and the response
- Validate Input — shows a separate execution triggered by Call Pattern with the validation logic
- Process Order — shows a separate execution triggered by Call Pattern with the calculation and confirmation
Each pattern has its own execution log, making it easy to debug each component independently.
How the composition model works
This tutorial demonstrates several key principles of DRAGOPS pattern composition:
- Patterns as functions. Each pattern has a defined interface — typed inputs via On Pattern Call and typed outputs via Respond With. Callers do not need to know the internal implementation.
- Independent deployment. You can update the Validate Input pattern (add new validation rules, change error messages) without modifying the Order Pipeline or Process Order patterns. As long as the interface stays the same, the system continues to work.
- Separation of concerns. Validation logic lives in one pattern, business logic in another, and orchestration in a third. Each is focused, testable, and reusable.
- Sequential orchestration. The Order Pipeline calls patterns in sequence — validate first, then process. The execution engine handles the handoff between patterns automatically.
What you learned
- How to design a multi-pattern system with clear interfaces between components
- How to define typed inputs on On Pattern Call and typed outputs on Respond With
- How to call one pattern from another using Call Pattern and use the returned values
- How to orchestrate a pipeline that conditionally calls different patterns based on results
- How to return structured JSON responses from a webhook-triggered orchestrator
- How to inspect execution logs across multiple patterns to debug the full flow
What is next?
GitHub webhook handler
Build a pattern that routes GitHub events by type.
Handle errors
Add error handling across your multi-pattern pipeline.
Call patterns from patterns
Deep dive into the composition model, interfaces, and deployment.
Deploy a pattern
Manage the deployment lifecycle for your composed patterns.