Appearance
Common Workflow Compositions
Understanding common workflow compositions helps you design better workflows and solve problems more effectively.
1. Fan-Out/Fan-In (Parallel Processing)
○ → [Prepare Data] → ◇+ → [Process A] → ◇+ → [Combine Results] → ●
└ → [Process B] → ┘
Use when: Processing the same data with multiple services simultaneously
Benefits:
- Faster execution (parallel instead of sequential)
- Independent processing paths
- Results synchronized automatically
Example: Execute a quantum circuit on multiple backends to compare results.
2. Pipeline (Sequential Processing)
○ → [Step 1] → [Step 2] → [Step 3] → [Step 4] → ●
Use when: Each step depends on the previous step's output
Benefits:
- Clear data flow
- Simple to understand and debug
- Each step transforms data for the next
Example: Generate circuit → Encode → Execute → Decode → Visualize
3. Conditional Flow (Exclusive Gateway)
○ → [Check Condition] → ◇× → [Path A] → ●
└→ [Path B] → ●
Use when: Different actions needed based on data or conditions
Benefits:
- Dynamic workflow behavior
- Handle different scenarios
- Optimize based on input characteristics
Example: Use fast optimization for small problems, accurate optimization for large problems.
Setting Conditions:
- Add an Exclusive Gateway (◇×) from the palette
- Create multiple outgoing paths
- Select each sequence flow (arrow)
- In properties, set Condition expression:javascript
= count(flightRoutes) < 5 // Fast path = count(flightRoutes) >= 5 // Accurate path
4. Error Handling with Boundary Events
○ → [Main Task] → [Success Action] → ●
│
└→ [Error Handler] → [Cleanup] → ●
Use when: You need to handle failures gracefully
Benefits:
- Graceful degradation
- User notification on errors
- Cleanup and recovery actions
Implementation:
- Select a service task
- Click Append Boundary Event → Error Boundary Event
- Connect error event to error handling tasks
- Add notification or cleanup services
5. Looping (Multi-Instance)
○ → [For Each Item in Array] → [Process Item] → [Collect Results] → ●
Use when: You need to process array data iteratively
Benefits:
- Process collections automatically
- Parallel or sequential execution
- Aggregate results
Implementation:
- Select a service task
- In properties, find Multi Instance
- Set Loop Type: Parallel or Sequential
- Set Input Collection: Array variable name
- Set Element Variable: Name for current item
Example: Process each flight route individually for detailed analysis.
6. Timer Events (Scheduled Execution)
○ (clock icon) → [Periodic Task] → [Process Data] → ●
Use when: You need periodic or scheduled execution
Benefits:
- Automated scheduling
- Time-based triggers
- Periodic monitoring
Types:
- Timer Start Event: Trigger workflow on schedule
- Timer Intermediate Event: Wait for duration
- Timer Boundary Event: Timeout handling
Example: Run optimization every hour with latest flight data.
7. Message Events (External Triggers)
○ (envelope icon) → [Wait for Message] → [Process] → ●
Use when: Workflows triggered by external systems
Benefits:
- Event-driven architecture
- Integration with external systems
- Asynchronous communication
Use Cases:
- API webhooks
- External data updates
- User actions