API-07: zentrale-webhook-registry-zustellung (postgres-jobqueue, hmac-signatur, backoff)

This commit is contained in:
sysops
2026-08-28 09:03:06 +02:00
parent 27f9866264
commit 627961b972
5 changed files with 536 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
DROP TABLE webhook_deliveries;
DROP TABLE webhook_subscriptions;
+27
View File
@@ -0,0 +1,27 @@
-- Zentrale Webhook-Registry & Zustellung (API-07, siehe
-- core-kanban/tickets/API-07.md) — Postgres-basierte Jobqueue, kein
-- Redis/AMQP (Ticket-Vorgabe).
CREATE TABLE webhook_subscriptions (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
event_type TEXT NOT NULL,
target_url TEXT NOT NULL,
secret TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX webhook_subscriptions_event_type_idx ON webhook_subscriptions (event_type);
CREATE TABLE webhook_deliveries (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
subscription_id UUID NOT NULL REFERENCES webhook_subscriptions(id),
event_type TEXT NOT NULL,
payload JSONB NOT NULL,
status TEXT NOT NULL DEFAULT 'pending', -- pending|delivered|failed
attempt INT NOT NULL DEFAULT 0,
next_attempt_at TIMESTAMPTZ NOT NULL DEFAULT now(),
last_error TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
delivered_at TIMESTAMPTZ
);
CREATE INDEX webhook_deliveries_due_idx ON webhook_deliveries (status, next_attempt_at);