-
Notifications
You must be signed in to change notification settings - Fork 0
/
worker.js
24 lines (21 loc) · 634 Bytes
/
worker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var amqp = require('amqp'),
debug = require('debug')('notificare:rabbitWorker');
var connection = amqp.createConnection({ host: "localhost", port: 5672});
connection.on('ready', function () {
connection.queue("my-queue", {
autoDelete: false,
durable: true
}, function(queue){
debug('Bound to queue %s', queue.name);
// queue.bind('service-central-exchange', '#', function(queue) {
// debug('Bound queue %s', queue.name);
// });
queue.subscribe({
ack: true,
prefetchCount: 1
}, function (data, headers, info, message) {
debug('Received a message: %s', data.ping);
message.acknowledge();
});
});
});