Some sugar for amqp.node library
- channel pool
channel.publish
andchannel.sendToQueue
replaced with a Writable streamchannel.consume
replaced with a Readable stream
npm i rmqp
RabbitMQ Tutorials
const amqp = new AmqpClient(AMQP_URL);
amqp.assertQueue('job_queue');
const publisher = amqp.publisher(q, { contentType: 'application/json' });
publisher.write({taskId: 1, ...});
publisher.write({taskId: 2, ...});
publisher.end();
const amqp = new AmqpClient(AMQP_URL);
amqp.assertQueue('task_queue');
amqp.subscriber(q, { noAck: false, prefetch: 1 })
.on('data', (message) => {
...
message.ack();
});