Service API Patterns, Protocols, Coupling Types, Metrics > Fundamental Service API Patterns > Service Agent
How can common event-driven logic be separated and governed independently?
Services can become bloated and inefficient when required to encapsulate common, cross-cutting logic. Furthermore, service interaction may be inefficient when granular cross-cutting logic requires explicit API invocation by service consumers. The application of the Service Agent pattern establishes the service agent, an event-driven program capable of transparently intercepting and processing messages sent to or from services. Service agents do not have an API and are therefore not explicitly invoked. They generally provide highly reusable logic; each agent is usually used by many services and service consumers. Service agents are almost always classified as intermediaries as part of a greater service activity. Common functions performed by service agents include routing, logging, validation, load balancing and security-related processing.
An example of the Service Agent pattern as applied to a REST service and its supporting HTTP server.