rabbitmq-enterprise-toolkit
Version:
🚀 Enterprise-grade RabbitMQ wrapper for Node.js & TypeScript - High-throughput messaging with automatic retry, DLQ, batch processing & graceful shutdown. Production-ready AMQP client with zero message loss guarantee.
24 lines • 875 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Consumer = void 0;
const message_processor_1 = require("./message-processor");
const helpers_1 = require("../utils/helpers");
class Consumer {
constructor(getChannel) {
this.getChannel = getChannel;
this.messageProcessor = new message_processor_1.MessageProcessor(getChannel);
}
async registerConsumer(options) {
const channel = this.getChannel();
const queueNameNormalized = (0, helpers_1.normalizeQueueName)(options.queueName);
await channel.consume(queueNameNormalized, async (msg) => {
if (msg) {
await this.messageProcessor.processMessage(msg, options);
}
}, {
noAck: false // Manual ack
});
}
}
exports.Consumer = Consumer;
//# sourceMappingURL=consumer.js.map