feat: add webhook retry queue

This commit is contained in:
2026-06-09 11:32:34 +08:00
parent 81f170924c
commit 8f516fdc01
12 changed files with 940 additions and 74 deletions

View File

@@ -122,8 +122,11 @@ http://127.0.0.1:19080
- `GET /api/manage/cases/summary`
- `POST /api/manage/cases/{case_id}/handle`
- `POST /api/manage/webhooks/case-update`
- `GET /api/manage/webhooks/retries`
- `POST /api/manage/webhooks/retries/drain`
`/api/manage/webhooks/case-update` 需要请求头 `X-Webhook-Token`,并且请求体里的 `status` 目前固定为 `handled`
`/api/manage/webhooks/retries` 用于查看最新重试状态,`/api/manage/webhooks/retries/drain` 用于手动触发一次到期重试补偿。
## 运行识别计时进程
@@ -181,6 +184,9 @@ diagnostics_path = "logs/runtime_diagnostics.jsonl"
[case_sink]
path = "logs/cases.jsonl"
[webhook_retry_sink]
path = "logs/webhook_retry.jsonl"
[webhooks]
enabled = true
event_url = "https://example.com/runtime-events"
@@ -188,11 +194,16 @@ case_url = "https://example.com/case-events"
callback_token = "shared-secret"
connect_timeout_seconds = 3
read_timeout_seconds = 5
retry_backoff_seconds = 30
retry_batch_limit = 20
retry_max_attempts = 5
retry_max_backoff_seconds = 1800
```
运行时会额外记录:
- `logs/cases.jsonl`:本地处置单状态变更
- `logs/webhook_retry.jsonl`Webhook 重试队列状态快照
- `logs/webhook_delivery.jsonl`Webhook 投递结果审计
## 本地测试