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

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env node
const amqp = require('amqplib');
const exchange = 'direct_logs';
const args = process.argv.slice(2);
const routingKey = (args.length > 0) ? args[0] : 'info';
const text = args.slice(1).join(' ') || 'Hello World!';
(async () => {
let connection;
try {
connection = await amqp.connect('amqp://localhost');
const channel = await connection.createChannel();
await channel.assertExchange(exchange, 'direct', { durable: false });
channel.publish(exchange, routingKey, Buffer.from(text));
console.log(" [x] Sent %s:'%s'", routingKey, text);
await channel.close();
}
catch (err) {
console.warn(err);
}
finally {
if (connection) await connection.close();
};
})();