Вот фрагмент кода, который я использую для чтения очереди, попробуйте и используйте его и посмотрите, работает ли он
static async Task<string> Start()
{
string AccessKey = "";
string SecretKey = "";
string SQSqueues = "https://sqs.";
RegionEndpoint Region = RegionEndpoint.
bool processedSQS = false;
AWSCredentials credentials = new BasicAWSCredentials(AccessKey, SecretKey);
var AwsRegion = Region;
var SQSClient = new AmazonSQSClient(credentials, Region);
var SQSRequest = new ReceiveMessageRequest
{
MessageAttributeNames = AttributesList,
AttributeNames = new List<string>() { "All" },
MaxNumberOfMessages = 10,
QueueUrl = SQSqueues,
VisibilityTimeout = (int)TimeSpan.FromMinutes(10).TotalSeconds,
WaitTimeSeconds = (int)TimeSpan.FromSeconds(5).TotalSeconds
};
var SQSResponse = SQSClient.ReceiveMessageAsync(SQSRequest);
SQSResponse.Wait();
string JsonPass = null;
if (SQSResponse.Result.Messages.Count > 0)
{
foreach (var Message in SQSResponse.Result.Messages)
{
string SqsMessage = Message.Body;
bool CallUpload = await Insert.GetConfig(SqsMessage, credentials, AwsRegion, tableName);
if (CallUpload == true)
{
var deleteRequest = new DeleteMessageRequest
{
QueueUrl = SQSqueues,
ReceiptHandle = Message.ReceiptHandle
};
var deleteResponse = SQSClient.DeleteMessageAsync(deleteRequest);
deleteResponse.Wait();
}
}
}
return "";
}