What is the Azure Service Bus Queue?

Queues are a very common piece of infrastructure. It offers First In, First Out (FIFO) message delivery to one or more competing consumers. As the queue grows the last item added to the queue typically must wait longer to be processed. Just like someone waiting in line to order food, the first one in line gets to order first. Microsoft Azure Service Bus (ASB) is Microsoft’s premier enterprise-level messaging technology that uses this principle of FIFO.

Types of Queues:

  • Primary queue called main queue or active queue.
  • Secondary sub-queue called a _dead-letter queue _(DLQ).

Main Queue

ASB queues always have two parties involved-a producer and a consumer. The producer pushes the messages into the queue, while the consumer periodically polls for messages and consumes them. The main queue holds the messages until it is consumed or moved to the dead-letter queue.

Azure Service Bus Dead-letter Queues

The purpose of the dead-letter queue is to hold messages that cannot be delivered to any receiver, or messages that could not be processed.

The DLQ is mostly like any other queue, except that messages can only be submitted via the dead-letter operation of the parent entity. In addition, time-to-live is not observed, and you can’t dead-letter a message from a DLQ. The dead-letter queue fully supports peek-lock delivery and transactional operations. There is no automatic clean-up of the DLQ. Messages remain in the DLQ until you explicitly retrieve them from the DLQ.

Dead-letter queues are the safest bet when we are using Azure Service Bus. If for whatever reason message could not be processed by a receiver, we could move such a message to a dead letter queue.

Dead-letter Queue Reasons

Queued messages can fail delivery. These failed messages are recorded in a dead-letter queue. The failed delivery can be caused by reasons such as network failures, a deleted queue, a full queue, authentication failure, or a failure to deliver on time.

As the messages are moved from the active queue to the dead-letter, two properties DeadLetterReason and DeadLetterErrorDescription are added to the message.

#tutorial #azure #azure service bus #serveless

Azure Service Bus Dead-letter Queues
1.80 GEEK