1.0.0 • Published 5 years ago

poom-rabbitmq v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

poom-rabbitmq

A plugin helps to manage rabbitmq for poom

Install

npm i poom-rabbitmq -S

Examples

Typescript

Config rabbitmq information

import { RabbitMQ } from 'poom-rabbitmq';

RabbitMQ({
    host: 'localhost'
})

RabbitMQ({
    key: 'connection1',
    host: 'localhost'
})

Use in service file

import { RabbitMQ, RABBIT_MQ } from 'poom-rabbitmq';

export class ChartService {
    @RABBIT_MQ()
    static rabbitmq: RabbitMQ;
    
    @RABBIT_MQ('connection1')
    static rabbitMQ1: RabbitMQ;
    
    static async sendToRabbitmq(data: any = {}) {
        ChartService.rabbitmq.set('key', data, 60); // stored data and expired time is 60 secs
    }
}