[Event-Bus P3] Target dispatchers — Gotify, SQS, Temporal, webhook #23

Open
opened 2026-09-09 23:41:57 +00:00 by poimen · 0 comments
Member

What

Reliable delivery to each target type from the event router.

Targets

Gotify

POST http://gotify.notifications.svc.cluster.local/message?token=<app-token>
{"title": event.Type, "message": event.Subject, "priority": event.Priority}

SQS

POST http://management-service.sqs.svc.cluster.local:9090/queue/{queue}/message
Body: event JSON envelope

Temporal (signal to ObserverWorkflow)

client.SignalWorkflow(ctx, "observer-main", "", "event", event)

Webhook (generic HTTP POST)

POST <configured-url>
Body: event JSON
Retry: 3x exponential backoff (1s, 2s, 4s)

Depends On

  • #21 Core event router

Acceptance

Gotify Target

  • Event with priority 5 → Gotify message with priority 5
  • Event with priority 10 → Gotify message with priority 10
  • Gotify returns non-200 → dispatch error logged, does NOT block other targets
  • Gotify unreachable (connection refused) → dispatch error logged with latency

SQS Target

  • Event routed to SQS → message visible in configured queue: curl sqs-mgmt/queue/{name}/messages returns the event
  • Event JSON in SQS message matches canonical schema exactly
  • SQS unreachable → dispatch error logged

Temporal Target

  • Event dispatched → ObserverWorkflow receives signal (visible in Temporal Web UI event history)
  • ObserverWorkflow not running → dispatch error logged (not crash)
  • Signal payload is the full canonical Event struct

Webhook Target

  • Event POSTed to configured URL with Content-Type: application/json
  • Target returns 5xx → retried 3 times with exponential backoff (1s, 2s, 4s)
  • Target returns 4xx → NOT retried (client error)
  • All 3 retries fail → dispatch error logged
  • Target returns 200/202 on first try → no retry, success logged

Fan-out

  • Event matching 3 targets: target A fails, target B succeeds, target C succeeds → response shows A=failed, B=success, C=success
  • One slow target (3s) does not delay other targets (parallel dispatch)

Tests

  • go test ./internal/events/targets/ — each target with mocked HTTP client
  • go test ./internal/events/targets/ — retry logic: mock 5xx then 200 → success after retry
  • go test ./internal/events/targets/ — fan-out independence: one failure, others succeed
## What Reliable delivery to each target type from the event router. ## Targets ### Gotify ``` POST http://gotify.notifications.svc.cluster.local/message?token=<app-token> {"title": event.Type, "message": event.Subject, "priority": event.Priority} ``` ### SQS ``` POST http://management-service.sqs.svc.cluster.local:9090/queue/{queue}/message Body: event JSON envelope ``` ### Temporal (signal to ObserverWorkflow) ```go client.SignalWorkflow(ctx, "observer-main", "", "event", event) ``` ### Webhook (generic HTTP POST) ``` POST <configured-url> Body: event JSON Retry: 3x exponential backoff (1s, 2s, 4s) ``` ## Depends On - #21 Core event router ## Acceptance ### Gotify Target - [ ] Event with priority 5 → Gotify message with priority 5 - [ ] Event with priority 10 → Gotify message with priority 10 - [ ] Gotify returns non-200 → dispatch error logged, does NOT block other targets - [ ] Gotify unreachable (connection refused) → dispatch error logged with latency ### SQS Target - [ ] Event routed to SQS → message visible in configured queue: `curl sqs-mgmt/queue/{name}/messages` returns the event - [ ] Event JSON in SQS message matches canonical schema exactly - [ ] SQS unreachable → dispatch error logged ### Temporal Target - [ ] Event dispatched → ObserverWorkflow receives signal (visible in Temporal Web UI event history) - [ ] ObserverWorkflow not running → dispatch error logged (not crash) - [ ] Signal payload is the full canonical Event struct ### Webhook Target - [ ] Event POSTed to configured URL with `Content-Type: application/json` - [ ] Target returns 5xx → retried 3 times with exponential backoff (1s, 2s, 4s) - [ ] Target returns 4xx → NOT retried (client error) - [ ] All 3 retries fail → dispatch error logged - [ ] Target returns 200/202 on first try → no retry, success logged ### Fan-out - [ ] Event matching 3 targets: target A fails, target B succeeds, target C succeeds → response shows A=failed, B=success, C=success - [ ] One slow target (3s) does not delay other targets (parallel dispatch) ### Tests - [ ] `go test ./internal/events/targets/` — each target with mocked HTTP client - [ ] `go test ./internal/events/targets/` — retry logic: mock 5xx then 200 → success after retry - [ ] `go test ./internal/events/targets/` — fan-out independence: one failure, others succeed
poimen added this to the Event-Driven Platform milestone 2026-09-09 23:41:57 +00:00
poimen added the area/event-busstatus/todoarea/gatewaytype/featurepriority/medium labels 2026-09-09 23:41:57 +00:00
Sign in to join this conversation.