Martini Workflows Random Node
Overview
Random Nodes enable your workflows to randomly select one execution branch from multiple possibilities at runtime. This simple branching mechanism allows you to create workflows that make random choices between different execution branches during workflow execution.
What You Will Learn
- How Random Nodes work and when to use them for random selection
- Adding Random Nodes to your workflows through the Workflow Designer
- Configuring multiple execution branches and possibilities
- Managing branch possibilities by adding and removing options
- Best practices for implementing random workflow routing
When To Use This
Use Random Nodes when you need to:
- Randomly select between multiple servers or endpoints in a simple distribution setup
- Create workflows that randomly choose between different processing approaches
- Route requests randomly for testing different system behaviors
- Assign a value randomly using a Map Node or Script Node
Prerequisites
- Martini Designer installed and running on your system
- Create a Martini Package
- Create a Workflow
- Parts of a workflow
- Basic understanding of how to use Workflow Designer
Getting Started With Random Nodes
Adding Random Nodes to Workflows
Follow these steps to add a Random Node to your workflow:
- Navigate to your Martini Package and open your workflow.
- Click the Add Node button in the toolbar on the top left of the Workflow Designer.
- Select Random from the node types.
- Drag the Random Node to your desired position in the workflow.
Expected result: The Random Node appears in your workflow with two edge handles () by default, representing two initial execution possibilities.
Random Node Key Terms
| Term | Definition |
|---|---|
| Possibility | Individual execution branch that can be randomly selected during workflow runtime |
| Branch | Complete workflow path from the Random Node to subsequent processing nodes |
How Random Node Selection Works
Random Nodes operate by evaluating all configured possibilities at runtime and selecting exactly one branch for execution. Here's the operational flow:
- Runtime Evaluation: When workflow execution reaches the Random Node, Martini identifies all available possibilities
- Random Selection: The node randomly selects one possibility from all configured options
- Branch Execution: Workflow execution continues along the selected branch only
- Completion: Other possibilities are ignored for this execution cycle
The selection is truly random, meaning each possibility has an equal chance of being chosen regardless of previous executions or system state.
Random Node Benefits and Use Cases
Random Nodes solve workflow branching challenges by providing simple automated selection capabilities. Key benefits include:
- Simple Distribution: Randomly spread requests across multiple servers or endpoints with equal probability
- Processing Variation: Allow workflows to randomly choose between different processing methods
- Simplified Configuration: No complex routing logic required - straightforward random selection
- Equal Probability: Each configured possibility has the same chance of being selected
Implementing Random Branch Possibilities
Configure your Random Node to handle multiple execution scenarios by setting up distinct possibilities and connecting them to appropriate workflow logic.
Getting Started with Branch Configuration
Random Nodes begin with two default possibilities, each represented by an edge handle () that you can connect to different workflow branches:
- Upon adding the Random Node, locate the two edge handles () on the right side of the node.
- Configure each branch by creating edges from the Random Node to your target workflow logic nodes.
- Connect each possibility to different processing logic, endpoints, or service calls as needed.
You may add or remove random node possibilities. See Managing Random Node Possibilities.
Expected result: Each possibility now leads to a distinct workflow execution branch that can be randomly selected at runtime.
Managing Random Node Possibilities
Control the number of execution branches by adding or removing possibilities based on your workflow requirements.
Adding Possibilities to Random Nodes
- Click the Random Node to select it.
- Click the Add Possibility option to create a new edge handle.
Expected result: A new edge handle () appears, representing an additional execution possibility you can connect to workflow logic.
Removing Possibilities from Random Nodes
Reduce the number of execution branches when fewer options are needed:
- Click the Random Node to select it.
- Identify the possibility you want to remove - each possibility displays with an
xbutton. - Click the
xnext to the possibility you want to delete.
Expected result: The selected possibility and its edge handle are removed from the Random Node.
Random Node Configuration Best Practices
- Minimum Possibilities: Always maintain at least two possibilities for meaningful random selection
- Error Handling: Include error handling in each branch to manage failures gracefully
- Testing: Verify each possibility works correctly before deployment
Troubleshooting
| Problem | Detection | Cause | Fix |
|---|---|---|---|
| Only one branch executing | Workflow logs or output show same path result repeatedly | Only one possibility configured or connected | Add additional possibilities and verify edge connections |
| Random Node not executing | Workflow stops at Random Node | No possibilities configured or connected | Configure at least one possibility with valid edge connection |
| Uneven distribution | Some branches never execute in testing | Edges not properly connected to possibilities | Verify all possibilities have valid edge connections |
Helpful Resources
- Workflow Nodes Overview - Complete guide to all available workflow node types
- Map Node - Transform and manipulate data as it flows through your workflow
- Script Node - Run custom scripts for advanced logic and processing
- Fork Node - Learn about conditional branching alternatives
- Workflow Designer Guide - Master workflow creation and node management
- Workflow Concepts - Understand fundamental workflow principles
- Community Q&A: Martini Community
Have a Question? Post or search it here.