feat(alarm): trex-core 알람 emitter + trex.alerts exchange (dcy-033 BAT-049, Implemented)

AlarmEmitter(application, best-effort 비차단)+trex.alerts topic exchange 가산·격리+8 CRITICAL code 배선. 608 passed, opus QC PASS, 팀장 e2e(텔레그램 HTTP200) 통과. REQ-098~101 Implemented.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VHtM5Ws1HKCKQ4JGi6GRb5
This commit is contained in:
2026-06-21 19:25:55 +09:00
co-authored by Claude Opus 4.8
parent b2165eac25
commit d4c5fcbba1
29 changed files with 1195 additions and 47 deletions
+14
View File
@@ -62,6 +62,20 @@ EVENTS_EXCHANGE = "trex.events" # topic, durable
EVENTS_DLQ_EXCHANGE = "trex.events.dlq" # fanout, durable; receives unroutable/NACKed
EVENTS_DLQ_QUEUE = "trex.events.dlq" # one collector queue bound to DLQ exchange
# --- Alarm channel (dcy-033 / REQ-099) ---
# Independent of trex.events. mandatory=False (best-effort, notifier down = silent drop).
ALERTS_EXCHANGE = "trex.alerts" # topic, durable; alarm envelope channel
def alarm_routing_key(severity: str, source: str) -> str:
"""Build the routing key for an alarm event (dcy-033 / REQ-098).
Pattern: alarm.{severity}.{source} (e.g. alarm.critical.trex-core)
Severity is always lower-case. Source tokens containing '.' are safe
because notifier binds with alarm.# pattern (zero-or-more tail words).
"""
return f"alarm.{severity}.{source}"
def event_routing_key(event_type: str, strategy_id: str, symbol: str) -> str:
"""Build the routing key for an event (dcy-006 OQ-2 mapping)."""