Skip to main content

Tee Time Events Worker

Last updated: 2025-09-30

Background NestJS worker that consumes Tee Time events from BullMQ and performs domain actions (booking confirmations, reminders). A minimal HTTP server exposes health, metrics, and Swagger docs.

  • App: apps/teetime/events-worker
  • Queue: tee-time-events (see TEE_TIME_QUEUE in @digiwedge/tee-time-services or override via OUTBOX_EVENT_QUEUE)
  • Swagger: /api/docs

Jobs

Supported job names (exported as TeeTimeEvents):

  • teetime.booking.confirmed
    • Default provider: tee-time (internal DB). Payload:
      {
      "tenantId": 1,
      "slotId": 12345,
      "contactName": "Jane Golfer",
      "contactEmail": "jane@example.com",
      "contactPhone": "+27111222333",
      "externalRef": "WEB-ABC123"
      }
  • teetime.booking.reminder
    • Payload: { "clubId": number }

HTTP endpoints

  • GET /api – basic liveness
  • GET /api/metrics – Prometheus exposition
  • GET /api/health – Redis + queue status and app info
  • GET /api/docs – Swagger UI

Configuration

Required

  • REDIS_HOST, REDIS_PORT (and optional REDIS_PASSWORD)
  • TEETIME_DATABASE_URL – PostgreSQL URL for tee‑sheet data

Optional

  • CACHE_NAMESPACE – cache key prefix (default default)
  • MCA_SA_LIVE_V1_URL – SQL Server URL (legacy MCA writes only)
  • OUTBOX_EVENT_QUEUE – overrides the default queue name (tee-time-events)
  • OPENMETEO_BASE_URL, OPENMETEO_APIKEY – only used if weather/geocoding is invoked
  • PORT – HTTP port (default 3003 in container)

DLQ

Failed jobs (after max retries) are copied to tee-time-events:dlq. Use Nx targets to list, requeue, or purge (see project project.json).

Notes

  • The worker uses TeeTimeServicesModule. The module wires a no‑op outbox by default. Provide a custom EVENT_BUS/repository to publish domain events to a broker if required.