UNPKG

@goparrot/pubsub-event-bus

Version:
42 lines 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ManualStrategy = void 0; const tslib_1 = require("tslib"); const common_1 = require("@nestjs/common"); const interface_1 = require("../../interface"); const AbstractHandleWrapperStrategy_1 = require("./AbstractHandleWrapperStrategy"); let ManualStrategy = class ManualStrategy extends AbstractHandleWrapperStrategy_1.AbstractHandleWrapperStrategy { constructor() { super(...arguments); this.strategy = interface_1.AutoAckEnum.NEVER; } implementAckAndNack(handlerWrapper, channelWrapper) { const { handler } = handlerWrapper; Reflect.defineProperty(handler.prototype, 'ack', { ...Reflect.getOwnPropertyDescriptor(handler.prototype, 'ack'), value(event) { const message = event.message(); if (message) { channelWrapper.ack(message); } }, }); Reflect.defineProperty(handler.prototype, 'nack', { ...Reflect.getOwnPropertyDescriptor(handler.prototype, 'nack'), value(event) { const message = event.message(); if (message) { channelWrapper.nack(message); } }, }); } process(handlerWrapper, channelWrapper) { this.implementAckAndNack(handlerWrapper, channelWrapper); } }; exports.ManualStrategy = ManualStrategy; exports.ManualStrategy = ManualStrategy = tslib_1.__decorate([ (0, common_1.Injectable)() ], ManualStrategy); //# sourceMappingURL=ManualStrategy.js.map