-
Notifications
You must be signed in to change notification settings - Fork 1
queue amqp HowTo
GitHub Action edited this page Apr 21, 2026
·
1 revision
This guide explains AMQP-specific behaviors and configurations.
Unlike HTTP-based queues, AMQP relies on persistent TCP connections. The @quatrain/queue-amqp adapter is built to automatically attempt reconnection if the broker goes down or the connection drops. You do not need to wrap your send or listen calls in retry loops; the adapter handles channel recovery internally.
When listening to a RabbitMQ queue, you can control how many messages your worker pulls concurrently using the prefetch or concurrency option.
import { Queue } from '@quatrain/queue'
async function setupWorker() {
const queue = Queue.getAdapter('rabbitmq')
// The handler will receive up to 5 messages concurrently
await queue.listen('video-rendering', async (payload) => {
await processVideo(payload)
return true
}, { concurrency: 5 })
}