primer cambio

This commit is contained in:
beseira13
2026-01-19 12:12:38 -03:00
parent 5f59dba52d
commit 44990f015a
4759 changed files with 588702 additions and 0 deletions

34
node_modules/amqplib/examples/tutorials/worker.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env node
// Process tasks from the work queue
const amqp = require('amqplib');
const queue = 'task_queue';
(async () => {
try {
const connection = await amqp.connect('amqp://localhost');
process.once('SIGINT', async () => {
await connection.close();
});
const channel = await connection.createChannel();
await channel.assertQueue(queue, { durable: true });
channel.prefetch(1);
await channel.consume(queue, (message) => {
const text = message.content.toString();
console.log(" [x] Received '%s'", text);
const seconds = text.split('.').length - 1;
setTimeout(() => {
console.log(" [x] Done");
channel.ack(message);
}, seconds * 1000);
}, { noAck: false });
console.log(" [*] Waiting for messages. To exit press CTRL+C");
}
catch (err) {
console.warn(err);
}
})();