You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
920 B
39 lines
920 B
require('./harness').run(); |
|
|
|
var connects = 0; |
|
|
|
connection.addListener('ready', function () { |
|
connects++; |
|
puts("connected to " + connection.serverProperties.product); |
|
|
|
var e = connection.exchange(); |
|
|
|
var q = connection.queue('node-test-autodelete', {exclusive: true}); |
|
q.once('queueDeclareOk', function (args) { |
|
puts('queue opened.'); |
|
assert.equal(0, args.messageCount); |
|
assert.equal(0, args.consumerCount); |
|
|
|
q.bind(e, "#"); |
|
|
|
q.once('queueBindOk', function () { |
|
puts('bound'); |
|
// publish message, but don't consume it. |
|
e.publish('routingKey', {hello: 'world'}); |
|
puts('message published'); |
|
puts('closing connection...'); |
|
connection.end(); |
|
}); |
|
}); |
|
|
|
}); |
|
|
|
connection.addListener('close', function () { |
|
puts('close'); |
|
if (connects < 3) connection.reconnect(); |
|
}); |
|
|
|
|
|
process.addListener('exit', function () { |
|
assert.equal(3, connects); |
|
});
|
|
|