Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/state-ownership-and-concurrency/case/case-messaging-rabbit-f02.md
T
DongHyeonkaandClaude Opus 5 b2963105a8 docs(keycloak-session-store): import the session-storage lab as a new project
The keycloak project ended with four open questions that design could not
settle. A two-VM lab was built to answer them by measurement, and this is
that material: 26 experiments, 125 raw command outputs, 22 browser captures.

Follows the import procedure in README.md.

  source/     the originating repository verbatim — 78 documents, 28 SVGs,
              8 manifests, plus .source-revision recording the commit
  final/      the SSOT
    document.md   729 lines written from the 29 experiment documents, not
                  concatenated: what was predicted, what was measured, and
                  where the measurement itself was wrong
    evidence/raw    125 outputs, flattened to <experiment>__<file> because
                    the originals collided (01-baseline.txt appeared three
                    times) and the audit only globs the top level
    evidence/meta   one per raw file; command and exitCode are null and the
                    README says why rather than inventing them
    evidence/browser  22 captures
    assets/       three diagrams through techviz
    .techviz/     their VizSpecs

A separate project rather than an addition to keycloak: the B-layer answers
that project's four questions, but the A, C and D layers are about cluster
failure, SSO and operations, and one document.md should hold one subject.
The four question records there can point here through 관계.

Recorded rather than papered over: only three of the 28 diagrams were
remade. The repository forbids hand-drawn SVG and forbids titles inside the
canvas; all 28 originals carry both, so converting them is redrawing, not
reformatting. They stay in source/ and the gap is written into the document.

verify-pipeline.py passes. audit-records.py reports no issues.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 22:51:59 +09:00

94 lines
4.2 KiB
Markdown

---
kind: CASE
slug: messaging-rabbit-f02
title: 반환을 순번에 맞추는 조각이 production 에 없고, 시험이 그 자리를 스스로 메운다
topic: state-ownership-and-concurrency
project: clean-architecture-backend-template
status: 게시 전
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
rootTreeNode: case:messaging-rabbit-f02
evidenceCapturedOn: 2026-09-01
assets:
- key: messaging-rabbit-f02
file: ../../../final/evidence/rendered/messaging-rabbit-f02.svg
- key: messaging-rabbit-f02-diagram
file: ../../../final/assets/diagrams/messaging-rabbit-f02.svg
evidence:
- ../../../final/evidence/raw/messaging-rabbit-f02.txt
source:
- 원본 분석 절은 analysis/messaging/messaging-rabbit.md#L238 이다.
module: messaging-rabbit
priority: P2
---
# 반환을 순번에 맞추는 조각이 production 에 없고, 시험이 그 자리를 스스로 메운다
이 어댑터의 핵심 보장(§1)은 반환과 확인을 같은 발행 에 묶는 데 달려 있다. 묶는 열쇠는 순번이다.
## 문제
이 어댑터의 핵심 보장(§1)은 반환과 확인을 같은 발행 에 묶는 데 달려 있다.
묶는 열쇠는 순번이다.
## 결론
그런데 AMQP 의 basic.return 콜백은 순번을 주지 않는다.
교환기·라우팅 키·속성·본문만 온다.
그래서 발행자가 순번을 메시지에 실어 보내고 반환에서 되읽어야 한다.
RabbitHeaderMapper.toProperties 전문에 그런 헤더가 없다.
쓰는 것은 msg.* 예약 헤더들과 AMQP 의 messageId·correlationId·timestamp·deliveryMode 뿐이다.
그 조각이 존재하는 곳은 시험 하나다.
그 메서드의 javadoc 이 문제를 정확히 서술한다.
"the adapter has to" 인데 어댑터는 하지 않는다.
## 검증 환경
OpenJDK : 21.0.12 java -version 으로 확인
Gradle : 9.0.0 src/gradle/wrapper/gradle-wrapper.properties 의 distributionUrl 로 확인
확인 방식 : RabbitHeaderMapper 참조 13건 검색과 toProperties 전문에서 순번 헤더 유무 확인
소스 수정 : x
## 재현 조건
원문은 analysis/messaging/messaging-rabbit.md#L238 에 있다.
## 본문
<!-- body:start -->
이 어댑터의 핵심 보장(§1)은 반환과 확인을 **같은 발행** 에 묶는 데 달려 있고, 묶는 열쇠는 순번이다. 그런데 AMQP 의 `basic.return` 콜백은 순번을 주지 않는다 — 교환기·라우팅 키·속성·본문만 온다.
## 프로덕션에 없는 조각
:::evidence key="messaging-rabbit-f02-diagram" alt="msg 예약 헤더와 AMQP 표준 속성만 헤더 매퍼가 쓰는 것 안에 놓이고 순번 헤더가 바깥에 빗금으로 놓인다" caption="프로덕션에 없는 조각" zoom="false"
:::
`RabbitHeaderMapper.toProperties` 전문에 그런 헤더가 없다. 쓰는 것은 `msg.*` 예약 헤더들과 AMQP 의 `messageId`·`correlationId`·`timestamp`·`deliveryMode` 뿐이다.
## RabbitHeaderMapper 참조 위치
:::evidence key="messaging-rabbit-f02" alt="코드베이스에서 RabbitHeaderMapper 를 검색한 출력 13줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="RabbitHeaderMapper 코드베이스 검색 — 13줄 · exit 0" zoom="true"
:::
## 그 조각이 존재하는 곳은 시험 하나다
그 메서드의 javadoc 이 문제를 정확히 서술한다 — "the adapter has to" 인데 어댑터는 하지 않는다. `RabbitChannelPublisher` 의 javadoc 은 등록 경합(확인이 `basicPublish` 반환보다 먼저 올 수 있다)만 설명하고 이 상관 문제는 언급하지 않는다.
## 구현하는 사람이 규약을 다시 발명해야 한다
발명하지 않으면 `onReturn` 이 호출되지 않아 unroutable 발행이 **`CONFIRMED` 로 보고된다** — 이 어댑터가 존재하는 이유로 든 바로 그 실패다. 수정은 순번 헤더를 `RabbitHeaderMapper``RabbitPublishMapper` 로 올려 production 계약으로 만들고, 그 이름을 `RabbitChannelPublisher` javadoc 에 적는 것이다.
## 확인하지 못한 것
실행으로 재현하지 않았다. 매퍼 전문에 순번 헤더가 없다는 것과, 통합 시험이 자기 발행 람다에서 그 헤더를 붙인다는 것으로 판정했다.
<!-- body:end -->