Skip to content

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

Getting Started With Random Nodes

Adding Random Nodes to Workflows

Follow these steps to add a Random Node to your workflow:

  1. Navigate to your Martini Package and open your workflow.
  2. Click the Add Node button in the toolbar on the top left of the Workflow Designer.
  3. Select Random from the node types.
  4. 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:

  1. Runtime Evaluation: When workflow execution reaches the Random Node, Martini identifies all available possibilities
  2. Random Selection: The node randomly selects one possibility from all configured options
  3. Branch Execution: Workflow execution continues along the selected branch only
  4. 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:

  1. Upon adding the Random Node, locate the two edge handles () on the right side of the node.
  2. Configure each branch by creating edges from the Random Node to your target workflow logic nodes.
  3. 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

  1. Click the Random Node to select it.
  2. 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:

  1. Click the Random Node to select it.
  2. Identify the possibility you want to remove - each possibility displays with an x button.
  3. Click the x next 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