notifications.delivery.arq
arq
codex_platform.notifications.delivery.arq
ARQ delivery adapter — enqueues notification tasks into Redis/ARQ queue.
Example::
from arq.connections import create_pool, RedisSettings
from codex_platform.notifications.delivery.arq import ArqNotificationAdapter
pool = await create_pool(RedisSettings())
adapter = ArqNotificationAdapter(pool)
# Async context (preferred):
job_id = await adapter.enqueue_async("send_notification_task", payload)
# Sync context:
job_id = adapter.enqueue("send_notification_task", payload)
Classes
ArqNotificationAdapter
Bases: NotificationAdapter
Notification adapter that enqueues tasks into an ARQ/Redis queue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pool
|
ArqRedis
|
|
required |
Raises on infrastructure failures (Redis unavailable, serialization errors).
Source code in src/codex_platform/notifications/delivery/arq.py
Functions
enqueue(task_name, payload)
Sync enqueue — wraps async via asyncio. Use enqueue_async in async contexts.
Source code in src/codex_platform/notifications/delivery/arq.py
enqueue_async(task_name, payload)
async
Enqueue a notification task into the ARQ queue (async).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
task_name
|
str
|
ARQ worker function name (e.g. |
required |
payload
|
dict[str, Any]
|
Serialized |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
Job ID string, or None if ARQ returned no handle. |
Raises:
| Type | Description |
|---|---|
ConnectionError
|
Redis is unreachable. |
Exception
|
Any ARQ/Redis infrastructure failure. |