How do I roll-back a message to Amazon MQ (AMQ) from Lambda?

时间:2018-03-23 00:14:26

标签: node.js amazon-web-services aws-lambda activemq stomp

So, I assume this relates to any Node.js and Active MQ installation but I am using Amazon MQ with Node.js Lambda...

Kind of a noob on ActiveMQ so please correct me where I am wrong!

After reading a message from a queue using stompit I continue processing the message and it shall then be sent over HTTPS to another server. There is some message validation and enrichment happening on the way to the HTTPS POST, and of course the POST itself can result in an error.

How would I (best) handle a roll-back of the message in case of an error:

1) Keep the connection open and not send client.ack() until I finally got a HTTP 200 back from remote server?

2) Keep the message in a variable and put it back in case of error (sequence doesn't matter?

3) Use something other than stomp?

1 个答案:

答案 0 :(得分:0)

使用STOMP显然是不可能的,所以我改变了代码来改为使用库ampq10。

GROUP BY CHAR_LENGTH(my_field)

如果成功处理邮件,这将允许您执行 SELECT B.ID, B.Year, B.MonthValue INTO TableB_New FROM TableB T UNPIVOT ( MonthValue FOR Month IN (Jan, Feb, Mar) ) AS B 。如果您只是import amqp10 from 'amqp10'; const AMQPClient = amqp10.Client; const amqpClient = new AMQPClient({ receiverLink: { attach: { rcvSettleMode: amqp10.Constants.receiverSettleMode.settleOnDisposition }, creditQuantum: 1 } }); 发送receiver.accept(message);消息,则不会从队列中删除该消息。