const amqp = require('amqplib'); (async () => { const conn = await amqp.connect('amqp://rabbitmq'); const ch = await conn.createChannel(); await ch.assertQueue('messages'); console.log('Worker started, waiting for messages...'); ch.consume('messages', (msg) => { if (msg !== null) { console.log('Received:', msg.content.toString()); ch.ack(msg); } }); })();