queueHandler
function queueHandler(uri: string)
async
Establishes a connection to a RabbitMQ server.
Returns: Promise<Object>
- Resolves to a RabbitMQ connection instance.
See the official amqplib package documentation for more details:
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
uri | string | The AMQP server connection URI. |
Throws:
Will log an error and exit the process if the connection fails.
See:
const conn = await queueHandler("amqp://localhost");
const channel = await conn.createChannel();