Created
November 19, 2015 14:04
-
-
Save Teino1978-Corp/a3a275805ed662b4fcfa to your computer and use it in GitHub Desktop.
RabbitStew.createConsumers example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// function prototype to create queue and consumers with one call | |
RabbitStew.createConsumers(exchange, options, consumers); | |
// example usage | |
var exchange = RabbitStew.exchange(process.env.RABBIT_URL, 'test.exchange'); | |
var queue = createConsumers(exchange, { name: 'test.queue', exclusive: false }, { | |
'logs.error': function (data) { | |
... | |
return Promise.resolve('ack'); | |
}, | |
'logs.info': function ... | |
'logs.warn': function ... | |
}); | |
// this will create a queue with routingKey: [ 'logs.error', 'logs.warn', 'logs.info'] | |
// and add consumers for each routingKey. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment