I have a Lambda function and that lambda function is supposed to send messages to multiple queues in SQS and then exit,
If I add await, then messages are sent to all queues,
var sqsClient = ServerlessHelper.GetAmazonSqsClient();
foreach (var item in items)
{
await sqsClient.SendMessageAsync(item.QueueUrl, item.Message);
}
But if I remove await from the code, then none of messages are sent to queues. I want to send messages in parallel. But due to await I have function cannot send messages in parallel. I am trying to do something like this,
var sqsClient = ServerlessHelper.GetAmazonSqsClient();
foreach (var item in items)
{
sqsClient.SendMessageAsync(item.QueueUrl, item.Message);
}
// wait until are messages are sent to queues.
Is it possible to do this?