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
• 14,980 points
84 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 56,140 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,240 points
1,116 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
51 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
• 56,140 points
117 views
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
• 56,140 points
582 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.