feat: route terminal jobs to a durable DLQ
Declare the classic dead-letter topology, reject terminal worker outcomes without requeue, and add coverage for malformed messages and retry jitter.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
DEMO_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
LAB_ROOT="$(cd -- "${DEMO_DIR}/.." && pwd)"
|
||||
cd "${LAB_ROOT}"
|
||||
|
||||
demo_preflight() {
|
||||
if [[ ! -f .env ]]; then
|
||||
echo "Не найден .env. Подготовьте стенд по REPORT.md: cp .env.example .env и python3 scripts/setup-local-secrets.py" >&2
|
||||
return 2
|
||||
fi
|
||||
|
||||
local port
|
||||
port="${APP_PORT:-$(awk -F= '$1 == "APP_PORT" { gsub(/"/, "", $2); gsub(/[[:space:]]/, "", $2); print $2; exit }' .env)}"
|
||||
export BASE_URL="${BASE_URL:-http://localhost:${port:-8080}}"
|
||||
|
||||
for service in postgres s3 broker publisher worker lb; do
|
||||
if [[ -z "$(docker compose --env-file .env ps -q "$service")" ]]; then
|
||||
echo "Сервис '$service' не запущен. Поднимите стенд командами из REPORT.md; скрипт не скачивает образы и не запускает зависимости автоматически." >&2
|
||||
return 2
|
||||
fi
|
||||
done
|
||||
|
||||
python3 - "$BASE_URL" <<'PYTHON'
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
url = sys.argv[1].rstrip("/") + "/health/ready"
|
||||
try:
|
||||
with urllib.request.urlopen(url, timeout=5) as response:
|
||||
print(f"API готов: HTTP {response.status} ({url})")
|
||||
except (urllib.error.URLError, TimeoutError) as exc:
|
||||
raise SystemExit(f"API недоступен по {url}: {exc}")
|
||||
PYTHON
|
||||
}
|
||||
Reference in New Issue
Block a user