We have azure api gateway for inbound and outbound calls for our application .
We need a queue for failed cases with exponential time logic for retry mechanism .
I need to know what will be the best solution : whether to go with third party services like rabbit mq or kafka or Azure storage queue .
Can someone give me any advice?
Azure provides Storage queues and Service Bus queues. Storage queues are part of the Azure Storage infrastructure and allow you to store large numbers of messages.
Use Storage queues when the application store over 80 GB of messages in a queue.
Service Bus queues are used when you need to receive messages without having to poll the queue, requires the queue to provide a FIFO ordered delivery, and support automatic duplicate detection, or requires transactional behaviour and atomicity when sending or receiving multiple messages.
For retry mechanism, use the exponential backoff algorithm
.
int retry_Count = 0;
int maxRetry_Count = 5;
TimeSpan time_delay = TimeSpan.FromSeconds(1);
while (true)
{
try
{
break;
}
catch (Exception ex)
{
if (retry_Count >= maxRetry_Count)
{
throw;
}
retry_Count++;
await Task.Delay(time_delay);
time_delay = time_delay + time_delay;
}
}
And Third-party services like RabbitMQ
or Kafka
also be used for implementing a queue.
RabbitMQ is an open-source message broker that provides robust queuing functionality. It offers features such as message durability, routing, and flexible routing topologies.
Connecting RabbitMQ to Azure Service Bus
For more information, check the Policies in Azure API Management and Azure Storage queues and Service Bus queues.