- analysis/·source-index·state.json 을 final/document.md 제2부·제3부로 접었다. SSOT 는 하나다 - 파일럿 — commit-ambiguity-as-a-result 를 새 기준으로 재선별. 후보 14 → 글감 5 (PROMOTE 5 · MERGE_INTO 3 · KEEP_IN_SSOT 4 · 보류 2). 기록 5건을 다시 썼고 그림 1개를 techviz 로 만들었다 - 재선별이 잡은 것: 제1부 §6.2·§11.1 이 자기 §13.2 와 어긋나 있었다(레인을 안 돌렸다 vs 돌렸다) — 정정. 이미 답이 나와 있던 Question 을 HEAD 재실행 질문으로 다시 세웠다. Concept 이 인용한 코드가 SSOT 에 없어 뺐다 - candidateScope·sourceRepository 기록. 나머지 43개 주제는 재선별 대기(PENDING 905) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
73 lines
4.3 KiB
Markdown
73 lines
4.3 KiB
Markdown
---
|
|
kind: CONCEPT
|
|
slug: messaging-inbox-jdbc-postgresql-c03
|
|
title: 두 오버로드가 있었고 호출되는 쪽이 틀린 쪽이었다
|
|
topic: transaction-and-consistency-models
|
|
project: clean-architecture-backend-template
|
|
status: 게시 전
|
|
sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916
|
|
rootTreeNode: concept:messaging-inbox-jdbc-postgresql-c03
|
|
evidenceCapturedOn: 2026-09-01
|
|
assets:
|
|
- key: messaging-inbox-jdbc-postgresql-c03
|
|
file: ../../../final/evidence/rendered/messaging-inbox-jdbc-postgresql-c03.svg
|
|
- key: messaging-inbox-jdbc-postgresql-c03-diagram
|
|
file: ../../../final/assets/diagrams/messaging-inbox-jdbc-postgresql-c03.svg
|
|
evidence:
|
|
- ../../../final/evidence/raw/messaging-inbox-jdbc-postgresql-c03.txt
|
|
source:
|
|
- 원본 분석 절은 final/document.md#a19-messaging-inbox-jdbc-postgresql#L146 이다.
|
|
module: messaging-inbox-jdbc-postgresql
|
|
---
|
|
|
|
# 두 오버로드가 있었고 호출되는 쪽이 틀린 쪽이었다
|
|
|
|
`requireActiveTransaction`이 이 leaf에서 가장 중요한 안전 장치이고, 이전 결함이 javadoc에 있다. 현재는 interface 메서드가 세 가지를 확인한다.
|
|
|
|
## 관계
|
|
|
|
- **컬럼 폭은 애플리케이션 검증과 짝을 이룬다**
|
|
같은 분석 리프에서 끌어낸 규칙이다.
|
|
- **같은 안전 규칙은 한 공식과 한 강제 시점을 갖는다**
|
|
같은 분석 리프에서 끌어낸 규칙이다.
|
|
|
|
## 본문
|
|
|
|
<!-- body:start -->
|
|
|
|
이 leaf에서 가장 중요한 안전 장치이고 이전 결함이 javadoc에 있다.
|
|
|
|
> "Package-private. It used to be public and was the only path that actually joined the caller's transaction, while the interface method — the one `IdempotentConsumer` calls — opened a raw connection that auto-commits. A reservation that commits on its own while the business side effect rolls back is a message that will never be redelivered and whose work never happened."
|
|
|
|
**두 개의 오버로드가 있었고 호출되는 쪽이 틀린 쪽이었다.**
|
|
|
|
## 예약 전에 확인하는 세 가지
|
|
|
|
:::evidence key="messaging-inbox-jdbc-postgresql-c03-diagram" alt="requireActiveTransaction 경계 안에 활성 트랜잭션과 읽기 전용 아님과 같은 DataSource 세 상자가 나란히 들어 있는 구조" caption="예약 전에 확인하는 세 가지" zoom="false"
|
|
:::
|
|
|
|
| 검사 | 실패 시 메시지의 핵심 |
|
|
|---|---|
|
|
| `isActualTransactionActive()` | "a reservation that commits alone marks a message processed whose work may still roll back" |
|
|
| `!isCurrentTransactionReadOnly()` | "the current one is read-only" |
|
|
| `hasResource(dataSource)` | "it is bound to another, so the reservation and the side effect would commit independently" |
|
|
|
|
세 번째가 특히 정교하다 — **트랜잭션이 활성이어도 다른 DataSource에 묶여 있으면 거절한다.** 멀티 데이터소스 배포에서 실제로 발생하는 형태이고, 그 경우 예약과 부작용이 서로 다른 트랜잭션에 들어간다. 세 검사 전부 같은 코드 `INBOX_TRANSACTION_REQUIRED`를 쓴다 — 메시지만 다르다.
|
|
|
|
## InboxPostgresIT 참조 위치
|
|
|
|
:::evidence key="messaging-inbox-jdbc-postgresql-c03" alt="코드베이스에서 InboxPostgresIT 를 검색한 출력 2줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="InboxPostgresIT 코드베이스 검색 — 2줄 · exit 0" zoom="true"
|
|
:::
|
|
|
|
**"the path nobody exercises before production"**가 이 leaf의 테스트 전략을 설명한다 — `InboxPostgresIT.aRolledBackTransactionLeavesNoReservationAndNoSideEffect`가 정확히 그 경로를 실 DB에서 돈다.
|
|
|
|
## 위임과 검증이 짝을 이룬다
|
|
|
|
`TransactionRunner`가 함수형 인터페이스이고 `<T> T inTransaction(Supplier<T> work)` 하나다. 즉 이 leaf는 Spring `@Transactional`에 의존하지 않고 **경계 제공을 호출자에게 위임**한다. `JdbcInboxRepository.requireActiveTransaction`이 그 위임이 지켜졌는지를 런타임에 확인한다.
|
|
|
|
## 중복이 정상 결과라는 명시
|
|
|
|
"A duplicate is not an error. It is the expected consequence of at-least-once delivery, so the skip path is a normal outcome rather than an exception." 세 금지가 `messaging-reliability-api`의 `TransactionalMessageAction` javadoc이 구현자에게 요구한 것과 대칭이다 — 그쪽은 action에게, 이쪽은 handler에게.
|
|
|
|
<!-- body:end -->
|