Skip to content

Instantly share code, notes, and snippets.

@Teino1978-Corp
Created November 19, 2015 14:04
Show Gist options
  • Save Teino1978-Corp/a3a275805ed662b4fcfa to your computer and use it in GitHub Desktop.
Save Teino1978-Corp/a3a275805ed662b4fcfa to your computer and use it in GitHub Desktop.
RabbitStew.createConsumers example.
// 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