azureapache-kafkaazure-web-app-serviceazure-storage-queues

Approach on queue implementation for failover in azure


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?


Solution

  • 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.

    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

    enter image description here

    enter image description here

    enter image description here

    For more information, check the Policies in Azure API Management and Azure Storage queues and Service Bus queues.