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

0 votes
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?
Sep 3, 2018 in AWS by bug_seeker
• 15,520 points
1,194 views

1 answer to this question.

0 votes

It is apparently not possible using STOMP so I've changed the code to use the library ampq10 instead.

import amqp10 from 'amqp10';

const AMQPClient = amqp10.Client;

const amqpClient = new AMQPClient({
  receiverLink: {
    attach: {
      rcvSettleMode: amqp10.Constants.receiverSettleMode.settleOnDisposition
    },
    creditQuantum: 1
  }
});

This will allow you to do a receiver.accept(message); if successfully handling the message. If you just .disconnect() whitout an .accept() the message will not be removed from the queue.

answered Sep 3, 2018 by Priyaj
• 58,100 points

Related Questions In AWS

0 votes
1 answer

How do I invoke another lambda async and pass context to it?

I tried several times trying to pass ...READ MORE

answered Apr 27, 2018 in AWS by Cloud gunner
• 4,670 points
6,283 views
0 votes
1 answer

How do I write an S3 Object to a file?

While IOUtils.copy() and IOUtils.copyLarge() are great, I would prefer the old ...READ MORE

answered Jul 13, 2018 in AWS by Hammer
• 360 points
4,556 views
0 votes
1 answer

How can I do Continuous data ingestion from on prem data sources to redshift

I can Recommend looking into AWS Schema ...READ MORE

answered Aug 8, 2018 in AWS by Priyaj
• 58,100 points
1,739 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+2 votes
2 answers

How do we move a domain from Hostgator to AWS Route 53?

I found this  Before transferring a domain, make ...READ MORE

answered Aug 3, 2018 in AWS by Priyaj
• 58,100 points
5,770 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP