Skip to content

Instantly share code, notes, and snippets.

@oguzhancagliyan
Created September 30, 2020 00:14
Show Gist options
  • Save oguzhancagliyan/259d717a7f357c44a61b98119e6c7949 to your computer and use it in GitHub Desktop.
Save oguzhancagliyan/259d717a7f357c44a61b98119e6c7949 to your computer and use it in GitHub Desktop.
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