Haredo

A type-safe rabbitmq client
Build status
npm install --save haredo

Typescript example

import { haredo, q } from 'haredo';
const rabbit = haredo({
    connection: 'amqp://localhost:5762'
});

interface MyMessage {
    id: number;
    status: string;
}

const myQueue = q<MyMessage>('myqueue');

rabbit.queue(myQueue)
    .subscribe(({ data }) => {
        console.log(data);
    });

rabbit.queue(myQueue)
    .publish({
        id: 1,
        status: 'active'
    });
                

Javascript example (with queue shorthand)

const { haredo } = require('haredo');
const rabbit = haredo({
    connection: 'amqp://localhost:5762'
});

rabbit.queue('myqueue')
    .subscribe(message => {
        console.log(message);
    });

rabbit.queue('myqueue')
    .publish({ id: 1, status: 'active' });