Skip to main content

Transactional outbox + delivery for Apso services (SQLAlchemy / FastAPI).

Project description

apso-domain-events (Python)

Transactional outbox + delivery for Apso services, built on SQLAlchemy 2.0 with an optional FastAPI integration. Implements the cross-language CONTRACT.md.

state change ─(same DB txn)→ DomainEvent row (capture)
                                   │
                       relay drains pending rows (poller)
                                   │
                       fan out to active destination(s) (delivery)

Install

pip install apso-domain-events            # webhook delivery needs no extra dep
pip install apso-domain-events[kafka]     # confluent-kafka
pip install apso-domain-events[aws]       # boto3 (sqs / eventbridge)
pip install apso-domain-events[fastapi]   # FastAPI integration

Wire it

from apso_domain_events import register_domain_events
from myapp.models import Product, Order  # the CLI-emitted manifest

register_domain_events(
    engine,                      # Engine or sessionmaker
    entities=[Product, Order],   # only these emit; never hardcoded in the lib
    poll_interval=5.0,
    app=app,                     # optional FastAPI app → startup/shutdown poller
)

Create the events table from Base.metadata (or your migration tool):

from apso_domain_events import Base
Base.metadata.create_all(engine)

Delivery

The active destination(s) are chosen at runtime from EVENTS_DESTINATION (comma-separated → fan-out):

name env dependency
webhook EVENTS_WEBHOOK_URL, EVENTS_WEBHOOK_SECRET none (stdlib HTTP + crypto)
kafka EVENTS_KAFKA_BROKERS, EVENTS_KAFKA_TOPIC [kafka]
sqs AWS_REGION, EVENTS_SQS_QUEUE_URL [aws]
eventbridge AWS_REGION, EVENTS_EVENTBRIDGE_BUS [aws]

At-least-once: fan-out re-sends to ALL destinations on retry. Consumers MUST dedupe on event.id.

The webhook adapter signs requests per Standard Webhooks (webhook-id, webhook-timestamp, webhook-signature: v1,...).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apso_domain_events-0.1.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apso_domain_events-0.1.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file apso_domain_events-0.1.0.tar.gz.

File metadata

  • Download URL: apso_domain_events-0.1.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for apso_domain_events-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e91081c5c98bbdcafd8ec9fa96df24dd05db4bec98aa4a464fb22efb3cd5eba5
MD5 7c0dc07af7e1d8f1d6e3805f60418e75
BLAKE2b-256 05b33f9aeb002b355ae96dd212eaec8a170644fa540700bf4adc7f240e859154

See more details on using hashes here.

Provenance

The following attestation bundles were made for apso_domain_events-0.1.0.tar.gz:

Publisher: auto-release.yml on apsoai/apso-packages

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file apso_domain_events-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for apso_domain_events-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 beac5b4502a9b5329de9d7b9128eda3fae1fcb32aff9fc1f7131ee2eba0bf169
MD5 bb6a8a5a1049140bdbcff996a1d50847
BLAKE2b-256 8f72ba9d23c016ae88d0a407dc6efebc5d91071dff8c1a3a9e401f86e1d56eea

See more details on using hashes here.

Provenance

The following attestation bundles were made for apso_domain_events-0.1.0-py3-none-any.whl:

Publisher: auto-release.yml on apsoai/apso-packages

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page