primer cambio
This commit is contained in:
21
node_modules/amqplib/examples/waitForConfirms.js
generated
vendored
Normal file
21
node_modules/amqplib/examples/waitForConfirms.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
const amqp = require('../');
|
||||
|
||||
(async () => {
|
||||
let connection;
|
||||
try {
|
||||
connection = await amqp.connect();
|
||||
const channel = await connection.createConfirmChannel();
|
||||
|
||||
for (var i=0; i < 20; i++) {
|
||||
channel.publish('amq.topic', 'whatever', Buffer.from('blah'));
|
||||
};
|
||||
|
||||
await channel.waitForConfirms();
|
||||
console.log('All messages done');
|
||||
await channel.close();
|
||||
} catch (err) {
|
||||
console.warn(err);
|
||||
} finally {
|
||||
if (connection) await connection.close();
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user