redis-smq-rest-api
Version:
REST API for RedisSMQ: OpenAPI 3 schema and Swagger UI for managing queues, messages, and consumers.
33 lines • 1.17 kB
JavaScript
import bluebird from 'bluebird';
const { promisifyAll } = bluebird;
export class MessagesService {
messageManager;
producer;
constructor(messageManager, producer) {
this.messageManager = promisifyAll(messageManager);
this.producer = promisifyAll(producer);
}
async getMessagesByIds(messageIds) {
return this.messageManager.getMessagesByIdsAsync(messageIds);
}
async getMessageById(messageId) {
return this.messageManager.getMessageByIdAsync(messageId);
}
async requeueMessageById(messageId) {
return this.messageManager.requeueMessageByIdAsync(messageId);
}
async deleteMessageById(messageId) {
return this.messageManager.deleteMessageByIdAsync(messageId);
}
async deleteMessagesByIds(messageIds) {
return this.messageManager.deleteMessagesByIdsAsync(messageIds);
}
async getMessageStatus(messageId) {
return this.messageManager.getMessageStatusAsync(messageId);
}
async publishMessage(message) {
await this.producer.runAsync();
return this.producer.produceAsync(message);
}
}
//# sourceMappingURL=MessagesService.js.map