Skip to main content

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:
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
uristringThe 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();