Service API Patterns, Protocols, Coupling Types, Metrics > Service API Proxy and Gateway Patterns > Intermediate Routing
How can dynamic runtime logic be abstracted and centralized?
With the application of the Intermediate Routing pattern, generic multi-purpose routing logic can be abstracted so that it exists as a separate part of the application architecture in support of multiple services and service consumers that may require this form of processing. Most commonly this is achieved through the use of event-driven service agents that transparently intercept messages and dynamically determine their paths.
A message passes through two router agents before it arrives at its destination. The rules-based router identifies the target service based on a business rule that the agent dynamically retrieves and interprets. The load balancing router then checks current usage statistics for that service before it decides which instance or redundant implementation of the service to send the message to.