postwait / node-amqp

[UNMAINTAINED] node-amqp is an AMQP client for nodejs
MIT License
1.69k stars 357 forks source link

Don't allow publishing to an exchange that is not open. #402

Closed v-yarotsky closed 8 years ago

v-yarotsky commented 8 years ago

Prevents nasty issues like callbacks that are not fired when publisher confirmations are turned on, caused by broker-client acknowledgement sequencing mismatch.

Whenever a connection error occurs, if publisher confirmations are enabled, all currently unacked messages emit 'ack error' instead of not calling the callback altogether.

There also are two tests that don't pass for me on master, as well as on this branch.

test/test-connection-blocked.js:
assert.js:93
  throw new assert.AssertionError({
        ^
AssertionError: 1 == 0
    at process.<anonymous> (/Users/vlad/Projects/node-amqp/test/test-connection-blocked.js:58:12)
    at process.emit (events.js:95:17)
FAIL
test/test-flow.js:
/Users/vlad/Projects/node-amqp/node_modules/longjohn/dist/longjohn.js:195
        throw e;
              ^
Error: NOT_IMPLEMENTED - active=false
    at Connection._onMethod (/Users/vlad/Projects/node-amqp/lib/connection.js:518:15)
    at self.parser.onMethod (/Users/vlad/Projects/node-amqp/lib/connection.js:136:12)
    at AMQPParser._parseMethodFrame (/Users/vlad/Projects/node-amqp/lib/parser.js:366:10)
    at frameEnd (/Users/vlad/Projects/node-amqp/lib/parser.js:93:16)
    at frame (/Users/vlad/Projects/node-amqp/lib/parser.js:78:14)
    at header (/Users/vlad/Projects/node-amqp/lib/parser.js:64:14)
    at AMQPParser.execute (/Users/vlad/Projects/node-amqp/lib/parser.js:137:21)
    at Connection.<anonymous> (/Users/vlad/Projects/node-amqp/lib/connection.js:174:21)
    at Connection.emit (events.js:95:17)
---------------------------------------------
    at module.exports.run (/Users/vlad/Projects/node-amqp/test/harness.js:49:23)
    at Object.<anonymous> (/Users/vlad/Projects/node-amqp/test/test-flow.js:1:84)
    at Module._compile (module.js:456:26)
    at Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Module._load (module.js:312:12)
    at Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
FAIL
v-yarotsky commented 8 years ago

Might help with https://github.com/postwait/node-amqp/issues/373.