--- kind: CONCEPT slug: messaging-outbox-jdbc-postgresql-c01 title: 모르는 것을 실패로 취급하지 않는다 topic: transaction-and-consistency-models project: clean-architecture-backend-template status: 게시 전 sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 rootTreeNode: concept:messaging-outbox-jdbc-postgresql-c01 evidenceCapturedOn: 2026-09-01 assets: - key: messaging-outbox-jdbc-postgresql-c01 file: ../../../final/evidence/rendered/messaging-outbox-jdbc-postgresql-c01.svg - key: messaging-outbox-jdbc-postgresql-c01-diagram file: ../../../final/assets/diagrams/messaging-outbox-jdbc-postgresql-c01.svg evidence: - ../../../final/evidence/raw/messaging-outbox-jdbc-postgresql-c01.txt source: - 원본 분석 절은 final/document.md#a19-messaging-outbox-jdbc-postgresql#L66 이다. module: messaging-outbox-jdbc-postgresql --- # 모르는 것을 실패로 취급하지 않는다 트랜잭셔널 아웃박스의 PostgreSQL 구현이다. 이 리프의 축은 하나다 — 모호한 발행을 같은 메시지 id로 재시도한다. ## 본문 **트랜잭셔널 아웃박스의 PostgreSQL 구현**이다. 비즈니스 트랜잭션이 쓰고 릴레이가 배출한다. 이 리프의 축은 하나다: **"모르는 것을 실패로 취급하지 않는다."** > "The relay's correctness rests on one rule: an ambiguous publish is retried **under the same message id**. Minting a new id would turn a possibly-delivered message into a definitely-second message, and no downstream deduplication could recover from it. Marking it failed instead would lose a message the broker may already hold." 마지막 문장이 중요하다 — 릴레이는 at-least-once publication만 보장한다고 자기 상한을 스스로 명시한다. ## 이 리프가 아는 것과 모르는 것 :::evidence key="messaging-outbox-jdbc-postgresql-c01-diagram" alt="리프 경계 안에 발행 포트와 관계형 데이터베이스가 들어 있고 브로커와 스프링 컨텍스트가 경계 밖 점선 상자로 놓인 구조" caption="이 리프가 아는 것과 모르는 것" zoom="false" ::: 경계: 브로커를 모른다(`MessagePublisher` 포트만 안다). 스프링 컨텍스트를 모른다(`spring-jdbc`/`spring-tx` 는 `implementation` 이며 트랜잭션 동기화 조회에만 쓴다). 배선은 starter 몫이다. ## MessagePublisher 참조 위치 :::evidence key="messaging-outbox-jdbc-postgresql-c01" alt="코드베이스에서 MessagePublisher 를 검색한 출력 14줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="MessagePublisher 코드베이스 검색 — 14줄 · exit 0" zoom="true" ::: ## 파괴적 작업 저널이 같이 사는 이유 `messaging-admin-api` 의 파괴적 작업 저널 구현도 이 리프에 산다. build.gradle 이 그 이유를 적는다 — "The destructive-operation journal lives here because it needs exactly what the outbox needs: one relational database every replica can see, and a migration lane that already exists. The contract it implements belongs to the admin API."