Skip to main content

Routing Slip

A Routing Slip attaches an ordered list of steps to a message so it routes itself through a per-message sequence of components without a central coordinator. It excels at flexible linear pipelines but does not handle branching, parallelism, or compensation.

Type
Integration
When to Use
Dynamic Processing Sequence, Per Message Workflow, Decentralized Routing

A Routing Slip attaches a list of processing steps to a message, like an itinerary, and the message visits each step in turn. Each component performs its work and forwards the message to the next destination named on the slip. The route is computed per message and travels with it, rather than being hardcoded in the infrastructure.

The problem it solves is variable, per-message processing sequences. When different messages need different chains of steps — and those chains are known only at runtime — building a fixed pipeline or a central router with every combination is impractical. The routing slip externalizes the route as data carried by the message.

How It Works

A component at the start determines which steps a message needs and writes them, in order, into a routing slip on the message. The message then flows to the first step. Each processing component does its job, consults the slip, removes itself, and dispatches the message to the next listed step. When the slip is empty, processing is complete and the message reaches its final destination.

Because the itinerary lives in the message, routing is decentralized: no central coordinator drives the flow. This makes the sequence flexible and the components reusable across many routes.

message{ slip: [validate, enrich, score, persist] }
  --> validate --> enrich --> score --> persist (slip now empty)

When to Use It

Use it when the processing sequence varies per message and is decided at runtime, when you want reusable steps composable into different chains, or when you prefer decentralized routing over a central orchestrator for linear workflows. It suits configurable pipelines and conditional processing chains.

Avoid it for complex flows with branching, parallelism, compensation, or long-running state; a Process Manager or Saga handles those better.

Trade-offs

The routing slip gives flexible, decentralized, composable routing with no central coordinator. The downsides are reduced visibility — the full route is scattered across messages and steps — and limited expressiveness, since it handles linear sequences but not branching or error compensation well. Each step must understand and honor the slip format, coupling components to that convention.

Related Patterns

It is an alternative to a series of Message Routers, moving the routing decision into the message. A Process Manager centralizes control for more complex flows, and a Saga adds compensation. A Content-Based Router can decide which slip to attach.

Example

A loan application service builds a routing slip based on the applicant: domestic applications get [verify-identity, credit-check, approve], while international ones get [verify-identity, sanctions-screen, credit-check, manual-review]. Each message carries its own slip and visits exactly the steps it needs.