UNPKG

@nestjstools/messaging-rabbitmq-extension

Version:

Extension to handle messages and dispatch them over AMQP protocol

26 lines 877 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AmqpChannel = void 0; const messaging_1 = require("@nestjstools/messaging"); const amqp_connection_manager_1 = require("amqp-connection-manager"); class AmqpChannel extends messaging_1.Channel { constructor(config) { super(config); this.config = config; this.connection = (0, amqp_connection_manager_1.connect)(this.config.connectionUri, { reconnectTimeInSeconds: 5, heartbeatIntervalInSeconds: 30, }); } createChannelWrapper() { return this.connection.createChannel(); } async onChannelDestroy() { if (!this.connection) return; await this.connection.close(); this.connection = undefined; } } exports.AmqpChannel = AmqpChannel; //# sourceMappingURL=amqp.channel.js.map