onirii
Version:
Universal queue SDK
37 lines (36 loc) • 1.47 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AmqpConfirmChannelService = void 0;
const tslib_1 = require("tslib");
const amqp_channel_service_1 = require("./amqp-channel-service");
/**
* Confirm Channel Service
*
* @since 1.0.0
* @date 2021-06-02
* @author Luminous
*/
class AmqpConfirmChannelService extends amqp_channel_service_1.AmqpChannelService {
constructor(name, currentConfirmChannel) {
super(name, currentConfirmChannel);
}
sendMessageToExchange(exchangeName, key, content, options, callback) {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
return this.currentChannelInstance.publish(exchangeName, key, content, options, callback);
});
}
sendMessageToQueue(queueName, content, options, callback) {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
return this.currentChannelInstance.sendToQueue(queueName, content, options, callback);
});
}
waitForConfirms() {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
if ('waitForConfirms' in this.currentChannelInstance) {
return this.currentChannelInstance.waitForConfirms();
}
throw new Error(`This Error Should Not Happened Current Channel: ${this.currentChannelInstance}`);
});
}
}
exports.AmqpConfirmChannelService = AmqpConfirmChannelService;