2.0.0 • Published 6 years ago

rbtmq v2.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago
const mq = new Rbtmq()

const config = {
    exchanges: [
        {
            name: 'test-exchange',
            type: 'topic',
            options: {
                autoDelete: true
            },
            queues: [
                {
                    name: 'test-queue',
                    pattern: 'path',
                    options: {
                        autoDelete: true
                    }
                }
            ]
        }
    ]
}
const data = {test: 'data'}
const spy = sinon.spy(function (msg) {
    assert.deepEqual(msg.body, data)
    msg.ack(false)
})

await mq.boot(config)

await mq.sub('test-queue', spy)
await mq.pub('test-exchange', 'path', data)