중재자
객체 집합의 상호작용을 캡슐화하는 객체를 정의해 직접 참조를 줄이는 행위 패턴
구조와 동작 원리
구성 요소와 배치 원칙 (조사 기반 개념 설명 · 연결 순서나 토폴로지는 특정하지 않음)
중재자 인터페이스와 colleague(component)로 구성되며 colleague는 중재자만 참조
다대다 의존성을 일대다로 바꾸고 상호작용 규칙을 중재자 한 곳에 집중
객체들이 서로 모두 연결되어 참조가 얽히고 상호작용 규칙이 분산되는 문제를 해결
기대 효과
객체 간 직접 참조를 제거해 느슨한 결합을 촉진하고 상호작용을 독립적으로 변경 가능
트레이드오프
중앙 메시지 흐름은 디버깅에 correlation id, lag, 타이밍 관찰이 필요해 추적 비용이 증가
설계 결함으로 객체가 과도하게 결합된 경우 중재자 적용보다 모델링 재검토가 필요
운영 및 적용 가이드
종합 설명 · 원문 인용으로 검증된 항목과 구분됩니다. 실제 적용 전 확인이 필요합니다.
언제 사용하는가
여러 컴포넌트·서비스 간 상호작용 규칙이 자주 바뀌고 직접 참조가 많아질 때, 중재자(중앙 조정 서비스, 이벤트 중재자, 워크플로 엔진)를 통해 메시지 흐름을 한 곳에서 조정하는 유스케이스에 적합하다. GUI 컨트롤 조정, 채팅방, 예약·주문 워크플로, 마이크로서비스 오케스트레이션 등이 대표적이다.
시나리오
예: 월 거래 1억 건 규모의 이커머스 주문 시스템에서 재고·결제·배송·알림 서비스가 서로 직접 호출해 결합도가 높아졌다. 주문 중재 서비스가 주문 이벤트를 받아 단계별 명령을 순서대로 발행하고 결과를 집계하도록 바꾼다. 요구사항은 서비스별 교체 용이성, 단계별 재시도·보상, 흐름 추적성이며 중재자는 규칙과 상태 전이를 중앙에서 관리한다.
배치 원칙
- 상호작용 규칙·라우팅·상태 전이는 중재자 계층에 집중
- colleague·서비스는 중재자 인터페이스만 의존
- 메시지·이벤트 채널과 DLQ를 중재자 경계에 배치
- 중재자별 설정·스키마·버전은 GitOps·구성 저장소로 중앙 관리
- 로그·트레이스·메트릭은 중재자와 각 참여자에 공통 계측
온프레미스
온프레미스에서는 중재자와 메시지 브로커·워크플로 엔진을 고가용성으로 직접 운영하고 네트워크·스토리지·인증서·백업을 조직이 책임진다. 배포는 VM·컨테이너 오케스트레이션 위에 구성하고 중재자 이중화, DB·큐 백업, 모니터링을 운영 표준에 포함한다.
클라우드
클라우드에서는 관리형 큐·이벤트 버스·워크플로 서비스로 중재자 패턴을 구현하고 IAM·오토스케일·멀티 AZ·관리형 관측성을 활용한다. 벤더 종속을 줄이려면 중재자 인터페이스와 이벤트 스키마를 추상화하고 인프라별 어댑터를 둔다.
Kubernetes
Kubernetes에서는 중재자를 Deployment·StatefulSet과 Service로 배포하고 CRD+controller·Operator의 reconciliation loop로 선언 상태와 관측 상태를 맞추는 조정 계층을 구현할 수 있다. HPA·PDB·NetworkPolicy·RBAC·ConfigMap·Secret·Probe를 적용하고 중재자와 참여자 간 통신은 Service·DNS와 메시지 브로커로 분리한다.
장애 대응
대표 장애는 중재자 병목·단일 장애점, 메시지 적체·중복·순서 꼬임, 다운스트림 타임아웃, 잘못된 라우팅·워크플로 정의이다. correlation id와 트레이스로 흐름을 추적하고 circuit breaker·타임아웃·백오프 재시도·DLQ 격리·보상 트랜잭션을 적용하며 DLQ age·depth와 중재자 지연·에러율에 경보와 소유자를 지정해 트리아지한다.
14개 관점별 근거
조사 당시 근거 보유 여부입니다. 출처의 정확성과 최신성을 별도로 판단하세요.
정의·개요근거 있음
객체 집합의 상호작용을 캡슐화하는 객체를 정의해 직접 참조를 줄이는 행위 패턴
Mediator is a behavioural design pattern that reduces chaotic dependencies between objects by forbidding them to talk to each other directly해결하는 문제근거 있음
객체들이 서로 모두 연결되어 참조가 얽히고 상호작용 규칙이 분산되는 문제를 해결
Objects that all talk to each other form a tangle of references that is hard to change or reuse.주요 구성 컴포넌트·리소스근거 있음
중재자 인터페이스와 colleague(component)로 구성되며 colleague는 중재자만 참조
Colleagues hold a reference to the mediator only, not to each other.데이터·에셋 배치 원칙근거 있음
다대다 의존성을 일대다로 바꾸고 상호작용 규칙을 중재자 한 곳에 집중
Many-to-many dependencies become one-to-many, and interaction rules live in one place.대표 유스케이스근거 있음
GUI 컨트롤 조정, 채팅, 항공 교통 관제 등 중앙 서버·중재자를 통한 상호작용
Chat applications where users communicate through a central server - Air traffic control systems managing communication between airplanes시나리오 예시근거 있음
공항 관제탑 비유: 조종사는 다른 조종사와 직접 협상하지 않고 관제탑과만 통신
Each pilot talks only to the tower, and the tower decides who lands next.부적합 상황·주의근거 있음
설계 결함으로 객체가 과도하게 결합된 경우 중재자 적용보다 모델링 재검토가 필요
If this is a case, we should not apply the Mediator Pattern.온프레미스 관점(개발·배포·운영)근거 있음
온프레미스에서는 고객 소유 K8s 클러스터를 배포 대상으로 두고 중앙 제어면이 dataplane agent를 통해 운영
BYOC On-Premise lets a customer bring an existing Kubernetes cluster and use it as the deployment target for your Product.클라우드 관점(개발·배포·운영)근거 있음
클라우드에서는 중재 계층으로 다양한 인프라·벤더 차이를 캡슐화해 종속과 영향 분리
provide a Cloud Mediation Layer, supporting multiple infrastructures and network backends to effectively prevent vendor lock-inKubernetes 관점(개발·배포·운영)근거 있음
K8s에서는 Operator의 CRD+controller/reconciliation loop로 선언 상태와 관측 상태를 조정
An operator adds a reconciler that keeps comparing declared state with observed state.장애 대응 관점근거 있음
중재자·의존성 장애 시 circuit breaker로 반복 실패를 차단하고 복구 여부를 시험
A circuit breaker is a small state machine in front of a dependency, shared by all runs, that stops calls after repeated failures장점근거 있음
객체 간 직접 참조를 제거해 느슨한 결합을 촉진하고 상호작용을 독립적으로 변경 가능
Mediator promotes loose coupling by keeping objects from referring to each other explicitly단점·트레이드오프근거 있음
중앙 메시지 흐름은 디버깅에 correlation id, lag, 타이밍 관찰이 필요해 추적 비용이 증가
Debugging a message flow takes correlation identifiers, lag dashboards and the ability to reason about timing.대표 기술·도구근거 있음
대표 기술·도구로 Camunda, Activiti 같은 BPM·워크플로 엔진이 중재자로 워크플로 단계를 오케스트레이션
Business process management systems (Camunda, Activiti) use a mediator to orchestrate workflow steps.추가 참고 문헌 (24)
- Mediator ↗
- Mediator Pattern | Software Design Patterns & Anti Patterns | Scott Vercuski ↗
- Mediator Design Pattern | Design Patterns In Action ↗
- The Mediator Design Pattern in Java | Baeldung ↗
- Mediator Design Pattern - GeeksforGeeks ↗
- Lesson 22.22 — Mediator | System Design From First Principles ↗
- The Mediator Pattern ↗
- Mediator Pattern in Event-Driven Architecture (EDA) - DEV Community ↗
- Beyond Operators: The Enterprise Control Plane Layer ↗
- Multi-Cloud Kubernetes Without Three Toolchains | Ops-Box ↗
- Agent-Based Kubernetes Deployment: A Complete Guide ↗
- Multi-Cloud Kubernetes Management with Argo CD ↗
- BYOC K8s - Omnistrate Documentation ↗
- Automated Multi-Cloud Large Scale K8s Cluster Lifecycle Management ↗
- Platform Overview | Coredge Documentation ↗
- ONAP MultiCloud Architecture ↗
- Lesson 20.7 — Event-driven architecture: broker and mediator topologies | System Design From First Principles ↗
- Designing Reliable Event-Driven Systems ↗
- 2.20 Error handling and resilience patterns — Software Engineering Guide ↗
- Resilience Patterns Can Make Your System Less Resilient ↗
- Interservice communication in microservices - Azure Architecture Center | Microsoft Learn ↗
- Mastering Event-Driven Architecture ( Part 5 ) : Strategies for Error Management and Data Reliability - Rahul Krishnan ↗
- Later, Not Never ↗
- Failure propagation, circuit breakers and fallback routes · Agent Orchestration Engineering ↗