Recently working on a project where there is a requirement to download documents from SFTP and need a queue based implementation for the same.
So i have opted the implementation using the SQS and lambda. Whenever the documents comes in SFTP i will push document information to SQS via web api. In SQS Message body i have passed the file name and other information.
Also created a .net core lambda function trigger for the SQS queue (used FIFO queue).
public async Task FunctionHandler(SQSEvent evnt, ILambdaContext context)
{
try
{
//trigger web api
var response = GetDocumentFromSFTP(message.Body).Result;
}
catch (Exception ex)
{
LambdaLogger.Log("Error::" + ex.Message);
}
}
if any error happens inside GetDocumentFromSFTP() where external web api is called and returns the flag true or false, or other places how can i retain message in SQS queue without deleting so that can poll the same message later?
Please help ?
Update: I have pushed some message to the queue and it got processed and couldn't see those messages even after visibility time over also.But the messages which are thrown error i am able to view in dead letter queue. Please refer the below image. Is this a known behavior?
