redis-smq-rest-api
Version:
A RESTful API for RedisSMQ
64 lines • 2.93 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConsumerGroupsService = void 0;
const bluebird_1 = __importDefault(require("bluebird"));
const { promisifyAll } = bluebird_1.default;
class ConsumerGroupsService {
constructor(consumerGroups, queuePendingMessages) {
this.consumerGroups = promisifyAll(consumerGroups);
this.queuePendingMessages = promisifyAll(queuePendingMessages);
}
deleteConsumerGroup(queueParams, consumerGroupId) {
return __awaiter(this, void 0, void 0, function* () {
yield this.consumerGroups.deleteConsumerGroupAsync(queueParams, consumerGroupId);
});
}
getConsumerGroups(queueParams) {
return __awaiter(this, void 0, void 0, function* () {
return this.consumerGroups.getConsumerGroupsAsync(queueParams);
});
}
saveConsumerGroup(queueParams, consumerGroupId) {
return __awaiter(this, void 0, void 0, function* () {
yield this.consumerGroups.saveConsumerGroupAsync(queueParams, consumerGroupId);
});
}
getPendingMessages(queueParams, consumerGroupId, cursor, pageSize) {
return __awaiter(this, void 0, void 0, function* () {
return this.queuePendingMessages.getMessagesAsync({
queue: queueParams,
groupId: consumerGroupId,
}, cursor, pageSize);
});
}
countPendingMessages(queueParams, consumerGroupId) {
return __awaiter(this, void 0, void 0, function* () {
return this.queuePendingMessages.countMessagesAsync({
queue: queueParams,
groupId: consumerGroupId,
});
});
}
purgePendingMessages(queueParams, consumerGroupId) {
return __awaiter(this, void 0, void 0, function* () {
return this.queuePendingMessages.purgeAsync({
queue: queueParams,
groupId: consumerGroupId,
});
});
}
}
exports.ConsumerGroupsService = ConsumerGroupsService;
//# sourceMappingURL=ConsumerGroupsService.js.map