squaremo/rabbit.js

specifying custom options/headers when sending messages

Opened this issue · 6 comments

kpe commented

it would be nice, if the rabbit.js API provides a way to specify custom AMQP headers when sending messages, i.e. pass custom options to methods like sendToQueue().
Something like passing an additional message options parameter to write/publish.

Which headers/properties? You might be better off using squaremo/amqp.node directly -- it's not much more complicated that rabbit.js.

Example uses that I would want header support for:

  1. User authentication
  2. Cross-Queue Auth
  3. Cross-Service Auth
    It seems like something that an abstraction would want considering it is a common feature for most message queues.

I agree, I'm trying to connect to an existing RabbitMQ server and getting a 403:

Error: Handshake terminated by server: 403 (ACCESS-REFUSED) with message "ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile."

I'm not seeing anything in this repo that would allow me to authenticate a connection. I'll look at amqp.node.

I'm not seeing anything in this repo that would allow me to authenticate a connection.

The createContext procedure allows you to supply a connection URL, and this takes the form given in http://www.rabbitmq.com/uri-spec.html. If you need to supply a username and password, use something like "amqp://user:pass@host".

That did it thanks

Funny, I'm back to this question; if I want to add a header like "message_id" (with a GUID value) should I upgrade to the AMQP.Node library? I'll give it a shot...