Skip to content

src/dazzle_back/events/postgres_bus.py

Generated: 2026-03-30T04:38:46.175263+00:00

Commit: 615f1354a103

Language: python

Scope: dazzle_back

Purpose

PostgreSQL-Backed Event Bus for Dazzle (Tier 1).

Provides a durable event bus using PostgreSQL with: - FOR UPDATE SKIP LOCKED for competing consumers - LISTEN/NOTIFY for low-latency wake-up - Full EventBus interface compliance - Transactional publish with domain writes

Ideal for Heroku deployments...

Key Exports

  • PostgresConfig
  • PostgresBus
  • connect
  • close
  • publish
  • publish_with_connection
  • subscribe
  • ack
  • nack
  • replay
  • get_consumer_status
  • list_topics
  • list_consumer_groups
  • get_topic_info
  • start_consumer_loop
  • poll_and_process
  • get_dlq_events
  • get_dlq_count
  • clear_dlq

Dependencies

Imports

  • asyncio
  • json
  • logging
  • collections.abc.AsyncIterator
  • dataclasses.dataclass
  • datetime.datetime
  • typing.Any
  • uuid.UUID
  • dazzle_back.events.base_event_bus.ActiveSubscription
  • dazzle_back.events.base_event_bus.BaseEventBus
  • dazzle_back.events.bus.ConsumerNotFoundError
  • dazzle_back.events.bus.ConsumerStatus
  • dazzle_back.events.bus.EventHandler
  • dazzle_back.events.bus.EventNotFoundError
  • dazzle_back.events.bus.NackReason
  • dazzle_back.events.bus.SubscriptionInfo
  • dazzle_back.events.envelope.EventEnvelope
  • psycopg
  • psycopg_pool
  • psycopg.rows.dict_row

Event Interactions

Emits: app.Order

Invariants and Assumptions

No invariants documented.

Tests

  • tests/unit/test_events.py
  • tests/unit/test_events_api.py

Notes

This page was automatically generated by tools/gen_reference_docs.py.