mateodelnorte / servicebus

Simple service bus for sending events between processes using amqp.
MIT License
420 stars 66 forks source link

A success/error callback on send & publish #48

Closed JeffreyTaylor closed 9 years ago

JeffreyTaylor commented 9 years ago

There is no promise/callback method to be able to move on or halt the program based on the output of a bus.send().

For example, if a queue is set to non-transient, an exception is thrown like this:

channel closed by server: 406 (PRECONDITION-FAILED) with message "PRECONDITION_FAILED - inequivalent arg 'durable' for queue 'queue-name in vhost '/': received 'true' but current is 'false'".

Ideally, the library would would have an api that looks like:

bus.send(..., function (error, response) {} or promises: bus.send().then() { // handle success here }.error() { // handle error here}

mateodelnorte commented 9 years ago

Yep. This is something I've been meaning to do, but haven't gotten the time yet. Happy to view a pull request if you want to submit one.