SOA Patterns > REST-inspired Patterns > Endpoint Redirection
Endpoint Redirection (Balasubramanian, Booth, Erl)
How can consumers of a specific service endpoint adapt when the service endpoint changes or is removed?
Problem
Service endpoint identifiers include information that can change over time. It may not be possible to replace all references to an out-of-date endpoint which can lead to the service consumer being unable to further interact with the service endpoint.
Solution
Automatically redirect service consumers that attempt to access out-of-date service endpoints to the current service endpoints.
Application
Include endpoint redirection as a feature of the service contract. When a service consumer attempts to invoke a stale service capability, return a redirection response. The service consumer follows the redirection instructions and retries the request on the new service capability.
Redirections can be temporary or permanent. Permanent redirections are automatically recorded in the service consumer’s configuration data to avoid subsequent requests to stale service capabilities.
For services relying on resource identifiers to express capabilities, changes to identifiers amount to a change to the runtime-discovered service contract. Redirection is able to facilitate these changes.
Impacts
The service consumer needs developed with the logic required to process the redirection instructions.
Explicit upgrades may be avoided entirely if permanent redirections are used. However, this can lead to wasteful runtime processing of repeated redirections that can be avoided by upgrading the service consumers.
Returning redirection information to the consumer requires consumers to determine in advance how much to trust a redirection response. A service that has been compromised from a security perspective may cause the consumer to permanently change its identifiers to point to an invalid or malicious service. A misconfigured service can lead to similar disruption. Care may also need to be taken in order to avoid infinite redirection loops.
Principles
Architecture
Composition, Service