notifications.delivery.base
base
codex_platform.notifications.delivery.base
Protocol definition for notification delivery adapters.
Classes
NotificationAdapter
Bases: Protocol
Contract for notification delivery transport.
Allows the same business logic to work with ARQ, Celery, Direct calls, or Django's built-in mail system.
Implementations MUST
- Raise exceptions on infrastructure failures (network, broker, DB).
- Return a job/task ID (str) when the backend provides one.
- Return None for fire-and-forget transports with no tracking ID.
Source code in src/codex_platform/notifications/delivery/base.py
Functions
enqueue(task_name, payload)
Deliver or enqueue the notification.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_name
|
str
|
Worker function name to execute. May be unused by adapters that deliver synchronously. |
required |
payload
|
dict[str, Any]
|
Serialized |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str | None
|
Job/task identifier for tracking. |
None |
str | None
|
When the transport is fire-and-forget. |
Raises:
| Type | Description |
|---|---|
Exception
|
Infrastructure errors MUST propagate — never swallow them. |