redis-smq-rest-api
Version:
A RESTful API for RedisSMQ
33 lines • 1.1 kB
JavaScript
import bluebird from 'bluebird';
const { promisifyAll } = bluebird;
export class MessagesService {
message;
producer;
constructor(message, producer) {
this.message = promisifyAll(message);
this.producer = promisifyAll(producer);
}
async getMessagesByIds(messageIds) {
return this.message.getMessagesByIdsAsync(messageIds);
}
async getMessageById(messageId) {
return this.message.getMessageByIdAsync(messageId);
}
async requeueMessageById(messageId) {
return this.message.requeueMessageByIdAsync(messageId);
}
async deleteMessageById(messageId) {
return this.message.deleteMessageByIdAsync(messageId);
}
async deleteMessagesByIds(messageIds) {
return this.message.deleteMessagesByIdsAsync(messageIds);
}
async getMessageStatus(messageId) {
return this.message.getMessageStatusAsync(messageId);
}
async publishMessage(message) {
await this.producer.runAsync();
return this.producer.produceAsync(message);
}
}
//# sourceMappingURL=MessagesService.js.map