Queue
Notification queue processing, monitoring, and retry logic.
Provenance uses a database-backed queue for reliable notification delivery.
How it works
- When an interaction matches a subscription, a notification is enqueued automatically via database trigger
- A cron job (or manual call) processes pending notifications in batches
- Failed notifications retry with exponential backoff (max 3 attempts)
- All attempts are logged in the audit trail
Processing the queue
# Process pending notifications
POST /api/queue/process?batchSize=10Set up a cron job to process automatically:
# Every minute
* * * * * curl -X POST https://provenance.onrender.com/api/queue/process?batchSize=10 -H "x-api-key: your-api-key"Monitoring
# Queue statistics
GET /api/queue/statsReturns counts of pending, processing, completed, and failed notifications.
Listing queue items
# List queue items with optional status filter
GET /api/queue?status=pending&limit=50&offset=0| Parameter | Description |
|---|---|
status | Filter by status: pending, retry, completed, failed |
limit | Items per page (default: 50) |
offset | Offset for pagination (default: 0) |
Retrying failed notifications
POST /api/queue/:queueId/retryResets a failed notification back to pending for reprocessing.
Deleting queue items
DELETE /api/queue/:queueIdPurging old items
Remove completed or failed items in bulk:
POST /api/queue/purge
{
"status": "completed",
"olderThan": "2024-01-01T00:00:00Z"
}| Field | Description |
|---|---|
status | completed or failed |
olderThan | ISO date — purge items older than this |
Retry logic
| Attempt | Delay |
|---|---|
| 1st retry | ~1 minute |
| 2nd retry | ~4 minutes |
| 3rd retry | ~9 minutes |
After 3 failed attempts, the notification is marked as permanently failed and logged in the audit trail.
Audit trail
Every notification attempt is recorded:
GET /api/auditsEach audit record includes the adapter response, status code, and any error messages.
Notification interactions
In addition to the audit trail, every notification delivery creates a provenance interaction with the same uowId as the original event. This makes the full lifecycle — from the triggering event through notification delivery — visible in traces and activity search.
See System Interactions for the complete payload reference.