Communication

Ambassador Pattern

Description

Creates a helper service that sends network requests on behalf of a client or consumer. It acts as an out-of-process proxy that is co-located with the client.

Where to use

  • Client-side load balancing.
  • \n
  • Smart routing.
  • \n
  • Circuit breaking logic on client side.

Real World Example

A legacy application needs to call a secure cloud API. An Ambassador proxy is installed on the localhost that handles the mTLS authentication, so the legacy app just calls localhost:8000.

Code Example

# Code Concept for Ambassador Pattern\n# This pattern is architectural.\n\nclass Service:\n    def execute(self):\n        # Implementation logic\n        pass