primer cambio
This commit is contained in:
22
node_modules/amqplib/examples/direct_reply_to_client.js
generated
vendored
Normal file
22
node_modules/amqplib/examples/direct_reply_to_client.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const amqp = require('../');
|
||||
|
||||
const queue = 'rpc_queue';
|
||||
|
||||
(async () => {
|
||||
const connection = await amqp.connect();
|
||||
const channel = await connection.createChannel();
|
||||
|
||||
await channel.consume('amq.rabbitmq.reply-to', async (message) => {
|
||||
console.log(message.content.toString());
|
||||
await channel.close();
|
||||
await connection.close();
|
||||
}, { noAck: true });
|
||||
|
||||
await channel.assertQueue(queue, { durable: false });
|
||||
|
||||
channel.sendToQueue(queue, Buffer.from(' [X] ping'), {
|
||||
replyTo: 'amq.rabbitmq.reply-to',
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user