notifications.delivery.direct
direct
codex_platform.notifications.delivery.direct
Direct delivery adapter — delivers notifications synchronously in-process.
Uses the full channel pipeline (ChannelRegistry → BaseDeliveryOrchestrator) without a message broker.
.. warning::
Calls ``asyncio.run()`` — MUST NOT be used inside a running event loop
(ASGI views, async handlers). Use ``ArqNotificationAdapter`` instead.
Classes
DirectNotificationAdapter
Bases: NotificationAdapter
Adapter for synchronous/monolithic notification delivery.
Injects a pre-built list of channels (via ChannelRegistry) into
BaseDeliveryOrchestrator and runs the async pipeline synchronously.
Uses lazy imports to avoid circular dependencies.
Source code in src/codex_platform/notifications/delivery/direct.py
Functions
enqueue(_task_name, payload)
Deliver a notification synchronously via the orchestrator pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
_task_name
|
str
|
Unused — direct delivery runs in-process. |
required |
payload
|
dict[str, Any]
|
Serialized |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
|
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If called from within a running event loop. |
Exception
|
Channel infrastructure failures propagate upward. |