Detour
The optional detour — enable/disable a step without redeploying.
Problem
During a compliance audit or an A/B test, one wants to route some messages through an extra path (enhanced audit log, double-validation, mirror to staging). How to do this without breaking the nominal flow?
Forces
- Nominal flow must remain fast and stable.
- Detour must be enable/disable hot.
- Detour conditions can evolve (10 % traffic, selected partners, specific types).
- Detour must be able to fail without blocking nominal flow.
Solution
Insert a configurable Detour at the critical point. The Detour evaluates a condition (feature flag, A/B group, partner whitelist) and: if true, executes the extra step then returns to flow; if false, short-circuits. Managed via Control Bus to enable/disable hot.
EDI implementation
In EDI, Detour is used for: (1) doubling Schematron validation during a new partner release phase, (2) capturing a copy of all MDNs for an audit, (3) testing a new mapping in parallel before cutover. Camel implementation: `.choice().when(detourCondition).to(detourEndpoint).end()`. Feature flag driven by LaunchDarkly or config.
Anti-patterns
- Forgotten permanent detour — becomes a permanent friction point.
- Blocking detour on failure — breaks nominal flow.
- Too many stacked detours — pipeline becomes unreadable.
Related patterns
- Control Bus — driving mechanism.
- Wire Tap — similar observation pattern.
Sources
- Hohpe G., Woolf B. — EIP, Detour (p. 545). www.enterpriseintegrationpatterns.com/patterns/messaging/Detour.html