--- kind: CONCEPT slug: messaging-core-api-c07 title: 동시성 지점이 하나뿐이다 topic: state-machines-and-ownership project: clean-architecture-backend-template status: 게시 전 sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 rootTreeNode: concept:messaging-core-api-c07 evidenceCapturedOn: 2026-09-01 assets: - key: messaging-core-api-c07 file: ../../../final/evidence/rendered/messaging-core-api-c07.svg evidence: - ../../../final/evidence/raw/messaging-core-api-c07.txt source: - 원본 분석 절은 final/document.md#a19-messaging-core-api#L463 이다. module: messaging-core-api --- # 동시성 지점이 하나뿐이다 트랜잭션 개념은 선언으로만 등장하고 DB 트랜잭션은 이 리프가 만지지 않는다. 동시성 지점은 `UuidV7.STATE` 하나다. ## 본문 트랜잭션 개념이 이 leaf에는 두 가지 형태로만 등장하고 둘 다 **선언**이다 — `MessagingCapabilities.brokerTransaction`, `ProcessingGuarantee.BROKER_TRANSACTIONAL`("Atomicity holds only inside the transaction scope the broker itself defines"), `ExternalSideEffectGuarantee.INBOX_TRANSACTIONAL`("An Inbox row and the side effect commit inside the same database transaction"). DB 트랜잭션은 이 leaf가 만지지 않는다. ## MessagingCapabilities 참조 위치 :::evidence key="messaging-core-api-c07" alt="코드베이스에서 MessagingCapabilities 를 검색한 출력 39줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="MessagingCapabilities 코드베이스 검색 — 39줄 · exit 0" zoom="true" ::: ## 유일한 동시성 지점 `UuidV7.STATE`(`AtomicLong`) 하나다. `updateAndGet`이 CAS 루프이므로 다중 스레드에서도 각 호출이 서로 다른 packed state를 얻는다. `RANDOM`(`SecureRandom`)은 thread-safe다. `MessageHeaders`는 생성 시 `LinkedHashMap`에 복사하고 `Collections.unmodifiableMap`으로 감싸 반환하므로 공유 안전하다. ## 최대 예순넷이라 실용상 문제가 아닌 선형 탐색 `find(String)`이 `values.entrySet().stream()` 선형 탐색이다 — 최대 64개이므로 실용상 문제는 아니지만 hot path에서 반복 호출되면 O(n)이다. ## 도달 불가능한 수명주기 필드 수명주기 개념은 `DeliveryContext.shutdownRequested`뿐이고, javadoc이 목적을 적는다 — "during a graceful drain the platform stops creating new retry attempts, and a long-running handler that can wind down early shortens the drain instead of being cancelled at the deadline." **이 필드는 production에서 도달 불가능하다**(§12.1).