208fb0b4f0
Task D.1: mandated dlq_item table (sourceType/sourceId/failureStage/errorCode/ retryCount/payloadRef/consumerName/scopeId/status). DlqService.record (idempotent per consumer+sourceId, bumps retryCount), onConsumerFailure (quarantine + clear the IiosProcessedEvent claim so it's replayable — fixes claim-then-fail), registerHandler + replay (clears claim, awaits the registered consumer handler → RESOLVED on success, QUARANTINED+retry on repeat throw; outbox-sourced items reset to PENDING). Wired into OutboxModule; resetDb truncates it. 3 tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
25 lines
793 B
SQL
25 lines
793 B
SQL
-- CreateTable
|
|
CREATE TABLE "IiosDlqItem" (
|
|
"id" TEXT NOT NULL,
|
|
"sourceType" TEXT NOT NULL,
|
|
"sourceId" TEXT NOT NULL,
|
|
"failureStage" TEXT NOT NULL,
|
|
"errorCode" TEXT,
|
|
"retryCount" INTEGER NOT NULL DEFAULT 0,
|
|
"payloadRef" TEXT,
|
|
"consumerName" TEXT,
|
|
"scopeId" TEXT,
|
|
"status" TEXT NOT NULL DEFAULT 'QUARANTINED',
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"lastFailedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"resolvedAt" TIMESTAMP(3),
|
|
|
|
CONSTRAINT "IiosDlqItem_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "IiosDlqItem_scopeId_status_idx" ON "IiosDlqItem"("scopeId", "status");
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "IiosDlqItem_consumerName_sourceId_key" ON "IiosDlqItem"("consumerName", "sourceId");
|