Phase 5: Outbox DLQ, Monitoring, Consumer-Registry

- Migration 0092: DLQ columns (error_message, failed_at) + consumer_inbox RLS fix
- outbox.py: DLQ logic, replay functions, stats, consumer registry
- app/routes/outbox.py: 5 API endpoints (stats, failed, replay, replay-all, consumer-registry)
- outbox_deliveries tracking per consumer handler
- 18/18 tests passing
This commit is contained in:
Agent Zero
2026-08-02 23:25:54 +02:00
parent 24cb10a7a2
commit 07a99975ec
12 changed files with 1017 additions and 79 deletions
+24 -1
View File
@@ -5,7 +5,7 @@ from __future__ import annotations
import uuid
from datetime import datetime
from sqlalchemy import DateTime, Integer, String, func
from sqlalchemy import DateTime, Integer, String, Text, func
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.dialects.postgresql import UUID as PGUUID
from sqlalchemy.orm import Mapped, mapped_column
@@ -54,3 +54,26 @@ class EventOutbox(Base):
published_at: Mapped[datetime | None] = mapped_column(
DateTime(timezone=True), nullable=True,
)
# Envelope columns (migration 0075)
aggregate_type: Mapped[str | None] = mapped_column(
String(100), nullable=True,
)
aggregate_id: Mapped[uuid.UUID | None] = mapped_column(
PGUUID(as_uuid=True), nullable=True,
)
occurred_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), nullable=False, server_default=func.now(),
)
correlation_id: Mapped[uuid.UUID | None] = mapped_column(
PGUUID(as_uuid=True), nullable=True,
)
schema_version: Mapped[int] = mapped_column(
Integer, nullable=False, server_default="1",
)
# Phase 5: DLQ columns
error_message: Mapped[str | None] = mapped_column(
Text, nullable=True,
)
failed_at: Mapped[datetime | None] = mapped_column(
DateTime(timezone=True), nullable=True,
)