UNPKG

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.

58 lines 2.03 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RabbitMQ = void 0; exports.createRabbitMQ = createRabbitMQ; exports.publish = publish; exports.createPublisher = createPublisher; exports.createConsumer = createConsumer; const rabbitmq_1 = require("./rabbitmq"); Object.defineProperty(exports, "RabbitMQ", { enumerable: true, get: function () { return rabbitmq_1.RabbitMQ; } }); /** * RabbitMQ instance oluştur */ function createRabbitMQ(config) { return new rabbitmq_1.RabbitMQ(config); } /** * Standalone publish fonksiyonu - hızlı mesaj gönderimi için */ async function publish(config, queueName, data, options) { const publishConfig = { ...config, mode: 'publisher-only' }; const rabbitmq = createRabbitMQ(publishConfig); try { await rabbitmq.publish(queueName, data, options); } finally { await rabbitmq.close(); } } /** * Publisher-only instance oluştur */ function createPublisher(config) { return createRabbitMQ({ ...config, mode: 'publisher-only' }); } /** * Consumer-only instance oluştur */ function createConsumer(config) { return createRabbitMQ({ ...config, mode: 'consumer-only' }); } // Export all types __exportStar(require("./types"), exports); __exportStar(require("./utils/errors"), exports); //# sourceMappingURL=index.js.map