abreits / node-red-contrib-amqp

Node-RED AMQP input and output nodes
16 stars 18 forks source link

way to acknowledge a amqpMessage #13

Closed rahuldev247 closed 6 years ago

rahuldev247 commented 6 years ago

Hi, I have been trying to acknowledge amqpMessage manually after setting noack:false in node.src.activateConsumer(Consume, { noAck: false }).then(function () {

when i try to call amqpMessage.ack(false); it gives error saying "write callback called multiple times", also i read in amqp-ts document , the ideal way to make this work is using the following code queue.activateConsumer((msg) => { //process the msg msg.ack(); });

How do i get the queue context in my function node where i am manually trying to acknowledge the message.

TinajaLabs commented 6 years ago

Curious to know the answer.

TinajaLabs commented 6 years ago

After more reading and tests it seems that just having the consumer/In Node connected will drain the queue regardless of downstream connectivity. The main reason for a message queue is to hold message payloads when a downstream connection fails. Otherwise... why inject more potential points of failure. ;)

I think you're on the right track regarding this issue.

I have the output of the consumer/In Node connected to a tcp port which passes message payloads to a separate host with graphite for charting. The idea is to store and forward the message payloads in a queue whenever that connection is broken.

Testing shows that the consumer node is always connected to and always consuming from RabbitMQ.

By what mechanism are we expected to inform the consumer node that a downstream connection has been lost; and should start queuing messages?

Thanks for any tips, Chris.