Created
September 30, 2020 00:14
-
-
Save oguzhancagliyan/259d717a7f357c44a61b98119e6c7949 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MovieLikeSeeder : ISqsSeeder | |
{ | |
public void CreateQueue(AmazonSQSClient client) | |
{ | |
CreateQueueRequest createDlqRequest = new CreateQueueRequest | |
{ | |
QueueName = "ArmutLocalStack-Test-DLQ.fifo", | |
Attributes = new Dictionary<string, string> | |
{ | |
{ | |
"FifoQueue", "true" | |
}, | |
} | |
}; | |
CreateQueueResponse createDlqResult = | |
client.CreateQueueAsync(createDlqRequest).GetAwaiter().GetResult(); | |
var attributes = client.GetQueueAttributesAsync(new GetQueueAttributesRequest | |
{ | |
QueueUrl = createDlqResult.QueueUrl, | |
AttributeNames = new List<string> { "QueueArn" } | |
}).GetAwaiter().GetResult(); | |
var redrivePolicy = new | |
{ | |
maxReceiveCount = "1", | |
deadLetterTargetArn = attributes.Attributes["QueueArn"] | |
}; | |
CreateQueueRequest createQueueRequest = new CreateQueueRequest | |
{ | |
QueueName = "ArmutLocalStack-Test.fifo", | |
Attributes = new Dictionary<string, string> | |
{ | |
{ | |
"FifoQueue", "true" | |
}, | |
{ | |
"RedrivePolicy", JsonSerializer.Serialize(redrivePolicy) | |
}, | |
} | |
}; | |
CreateQueueResponse createQueueResult = | |
client.CreateQueueAsync(createQueueRequest).GetAwaiter().GetResult(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment