Advanced (업데이트: 2026. 7. 19.)

물류 지연 알림 Pub/Sub 설계: Claude Code 점검 흐름

물류 Pub/Sub, 지연 알림, 재시도, DLQ, idempotency를 점검하는 글입니다.

물류 지연 알림 Pub/Sub 설계: Claude Code 점검 흐름

물류 회사에서 배차표의 ETA 하나를 바꾸면 이메일, LINE, 고객 포털 기록, CS 확인이 함께 움직일 수 있습니다. Pub/Sub consumer가 알림을 보낸 뒤 ack 전에 멈추면 같은 메시지가 다시 올 수 있습니다. 고객은 지연 알림을 두 번 받고 어떤 시간이 맞는지 묻습니다. 이 글은 그 사고를 Claude Code 점검 흐름으로 바꿉니다.

핵심 요점

물류 Pub/Sub 설계는 topic 이름보다 고객 안내에서 시작합니다. 어떤 ETA 변경이 외부 알림인지, 어떤 변경은 포털 기록만 남길지, 어떤 경우는 배차 담당자가 볼지 먼저 나눕니다. Claude Code는 표를 만들고, 계약 문구와 보상, 개인정보는 사람이 봅니다.

Workflow Before Pub/Sub Settings

subscription을 고치기 전에 배차 CSV에서 고객 알림까지의 길을 그립니다. shipmentId, status, ETA, channel, template, retry count, reviewer를 한 표에 놓습니다. 목표는 중복 알림, 확인 전화, CS 검토 시간을 줄이는 것입니다.

AreaWhat Claude Code draftsHuman review
Delay eventpayload fields, topic name, sample messagesshipper promise, delay reason, personal data
Notification sendidempotency key, retry rule, audit logcustomer channel, template wording, compensation
DLQ reviewalert fields, replay checklist, ownerwhether the notice is still useful
Metricsduplicate count, DLQ age, customer callsrevenue impact and consultation priority

3 Use Cases

Use case 1: Define delay events

실제 화면에서 시작합니다. 배차 보드, 고객 포털, 지연 사유 목록, 알림 템플릿을 Claude Code에 주고 외부로 나가도 되는 이벤트를 분리합니다.

  • Input: dispatch CSV columns, ETA changes, delay reasons, customer channel settings.
  • Output: event names, payload fields, and send rules for customer notices.
  • Human review: check contract wording, customer impact, personal data, and timing.

Use case 2: Stop duplicate notices

Use an idempotency key built from shipmentId, status, ETA, channel, and templateId. Pub/Sub may redeliver messages when ack timing is unclear, so the notification worker needs its own gate before email, LINE, or dashboard history is written.

  • Input: shipment ID, notification history, retry count, previous ETA, new ETA.
  • Output: duplicate detection rule, skip rule, audit log fields.
  • Human review: decide whether a changed ETA means a new notice or a correction.

Use case 3: Make DLQ visible to operations

Dead-letter topics should not become an engineer-only storage area. For logistics teams, a DLQ item may mean that a customer did not receive a delay notice. The operations screen should show shipment ID, oldest age, last error, owner, and whether a manual call already happened.

  • Input: retry count, last error, payload reference, customer account, owner.
  • Output: DLQ triage table, replay rule, manual contact checklist.
  • Human review: decide whether replaying the notice still helps the customer.

Copy-Paste Prompt

Act as a Korean logistics Pub/Sub notification reviewer.
Goal: prevent duplicate delay notices, stale ETA messages, and forgotten DLQ items.

Review these materials:
- dispatch CSV columns
- delay notice templates
- Pub/Sub topic and subscription names
- retry policy draft
- dead-letter topic draft
- customer notification channels

Return:
1. event names and payload fields
2. idempotency key proposal
3. retryable and non-retryable failure classes
4. DLQ triage table for operations
5. ten test events before production

Rules:
- do not expose customer phone numbers or driver personal data in payloads
- do not send stale ETA notices
- do not send the same idempotency key twice
- send compensation, apology, and contract questions to humans

Working Check Code

// verify-logistics-pubsub.mjs
// No dependencies. Run with: node verify-logistics-pubsub.mjs
const events = [
  {
    shipmentId: "S-1001",
    sequence: 12,
    status: "delayed",
    previousEta: "2026-07-19T16:30:00+09:00",
    eta: "2026-07-19T17:10:00+09:00",
    idempotencyKey: "S-1001:delayed:2026-07-19T17:10:00+09:00",
    channel: "line",
    retryCount: 0,
    dlqTopic: "delay-notice-dlq",
    reviewer: "cs-lead"
  },
  {
    shipmentId: "S-1001",
    sequence: 12,
    status: "delayed",
    previousEta: "2026-07-19T16:30:00+09:00",
    eta: "2026-07-19T17:10:00+09:00",
    idempotencyKey: "S-1001:delayed:2026-07-19T17:10:00+09:00",
    channel: "line",
    retryCount: 1,
    dlqTopic: "delay-notice-dlq",
    reviewer: "cs-lead"
  },
  {
    shipmentId: "S-1002",
    sequence: 5,
    status: "delayed",
    previousEta: "2026-07-19T18:20:00+09:00",
    eta: "2026-07-19T18:00:00+09:00",
    idempotencyKey: "S-1002:delayed:2026-07-19T18:00:00+09:00",
    channel: "email",
    retryCount: 4,
    dlqTopic: "",
    reviewer: ""
  }
];

const seen = new Set();
const problems = [];

for (const event of events) {
  if (seen.has(event.idempotencyKey)) {
    problems.push({
      shipmentId: event.shipmentId,
      reason: "duplicate idempotency key",
      fix: "publish the retry, but skip customer notification"
    });
  }
  seen.add(event.idempotencyKey);

  if (new Date(event.eta) <= new Date(event.previousEta)) {
    problems.push({
      shipmentId: event.shipmentId,
      reason: "ETA did not move later",
      fix: "do not send a delay notice; send to human review"
    });
  }

  if (event.retryCount >= 3 && !event.dlqTopic) {
    problems.push({
      shipmentId: event.shipmentId,
      reason: "retry limit reached without DLQ",
      fix: "route to delay-notice-dlq and alert the CS lead"
    });
  }

  if (!event.reviewer) {
    problems.push({
      shipmentId: event.shipmentId,
      reason: "missing reviewer",
      fix: "require a dispatcher or CS lead before customer send"
    });
  }
}

if (problems.length > 0) {
  console.table(problems);
  process.exitCode = 1;
} else {
  console.log("Pub/Sub delay notification checklist passed.");
}

Pitfall: Common Failure Cases

가장 큰 실수는 기술 재전송을 고객 알림 재전송으로 보는 것입니다. Pub/Sub는 다시 전달할 수 있지만 고객은 같은 알림을 두 번 받으면 안 됩니다.

First, teams confuse transport retry with customer retry. Pub/Sub can redeliver a message, but the customer should not receive the same email twice. The fix is an idempotency key stored by the notification service.

Second, teams rely on ordering alone. Ordering keys help, but the application still needs to reject old sequence numbers and stale ETAs before external sending.

Third, DLQ is left inside engineering tools. In logistics, that hides a customer communication gap. Move DLQ age and owner into the operations routine.

FAQ

Q. exactly-once delivery면 충분한가요?\n\nA. 아닙니다. 이메일, LINE, 포털 기록 앞에서 idempotency key를 저장하고 같은 key는 보내지 않는 처리가 필요합니다.

Q. Should Pub/Sub messageId be the idempotency key?

A. Usually no. A logistics notice should use business fields such as shipmentId, status, ETA, channel, and templateId so that the same customer-facing notice is recognized even when publishing changes.

Q. Can DLQ messages be replayed in bulk?

A. Not without a human check. A delay notice may become useless after delivery, so replay should inspect current ETA, delivery status, and manual contact history.

Q. Where should readers go next?

A. Teams that need Pub/Sub, Cloud Run, IAM, notification templates, and operational checks reviewed together should start from ClaudeCodeLab training.

What I Verified

한국어 버전에서는 물류 문맥, 중복 알림, DLQ 확인, 전화 문의 지표, 상담 CTA를 확인했습니다. I checked the official Google Cloud pages for Pub/Sub overview, subscriptions, retry policy, dead-letter topics, exactly-once delivery, and message ordering. I also checked that this article has one CTA, an internal link, external sources, executable JavaScript, and locale files.

#claude-code #물류 #pubsub #재시도 #dlq
무료

무료 PDF: Claude Code 치트시트

이메일을 입력하면 명령, 리뷰 습관, 안전한 워크플로를 정리한 PDF를 받을 수 있습니다.

개인정보를 안전하게 관리하며 스팸을 보내지 않습니다.

Masa

작성자 소개

Masa

Claude Code 실무 워크플로와 팀 도입을 검증하는 엔지니어입니다.