noodlefrenzy / node-amqp10

amqp10 is a promise-based, AMQP 1.0 compliant node.js client
MIT License
134 stars 56 forks source link

Sending headers documentation #360

Open siraajahmed opened 6 years ago

siraajahmed commented 6 years ago

Noticed an issue with ActiveMQ and this library.

When you send a message without any headers (we didn't know you had to send headers and where you would send them), the messages do not get persisted (despite the ActiveMQ documentation that says it does it by default).

Anyway, turns out you have to send messages with a durable header to node-amqp10 for persisted messages to work. THIS IS NOT OBVIOUS. This should be documented. Just putting it here in case anyone else comes across the same issue.

Code example of when you send without headers: sender.send("messageBody");

Code example of when you send with headers (this should be documented):

sender.send( { header: { durable: true }, body: 'messageBody' } );

swilliams-a3digital commented 6 years ago

Thanks for the message, I've been banging my head against the wall trying to figure out how to make messages durable. Your snippet above solved my problem. It would be great to add that snippet to the documentation.