# Detour

> Temporarily reroute messages through additional processing — switch it on, switch it off.

- **Category**: Integration
- **Subcategory**: System Management
- **Canonical URL**: https://designpattern.fyi/patterns/detour/

---

## Description
Clean, reusable architecture pattern.


## Use Cases
Production debugging — a subtle bug appears in order processing. Without a code change, Ops enables a Detour via the Control Bus that routes all orders through a detailed-logging service capturing full message state at each step. Bug diagnosed, Detour disabled — zero pipeline changes made.





## Trade-offs


### Advantages

- Add and remove processing steps at runtime without pipeline redeployment

- Useful for debugging, A/B testing processing logic, temporary enrichment

- Non-destructive — main flow is unaffected when Detour is disabled

- Toggle via Control Bus for operational flexibility




### Considerations & Drawbacks

- Adds routing complexity and a conditional processing hop

- When enabled — adds latency for every message going through it

- Detour component itself must be maintained

- Easy to forget to disable after the temporary need has passed







---
**Reference**: [Original Source](https://www.enterpriseintegrationpatterns.com/patterns/messaging/Detour.html)

