Skip to content

Instantly share code, notes, and snippets.

@calvinfo
Created May 7, 2013 19:51
Show Gist options
  • Save calvinfo/5535576 to your computer and use it in GitHub Desktop.
Save calvinfo/5535576 to your computer and use it in GitHub Desktop.
Multiple queue
function subscribe(queue) {
logger.info('API logger queue created.');
queue.bind('ingestion', '#');
var options = { ack : true, prefetchCount : 1000 };
queue.subscribe(options, function (payload, headers, deliveryInfo, message) {
importer.log(payload, function (err) {
try {
if (err) message.reject(true); // requeue the message
else message.acknowledge(false); // acknowledge only this message
} catch (e) {
logger.error('Error acknowledging queue message', { err : e });
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment