Question

Difficulty: MediumImplement Azure Queue Storage Solutions

You are developing a C# background service that processes large report generation requests from an Azure Queue Storage queue named report-jobs. Each report request payload can occasionally reach 150 KB in size. The background service takes up to 10 minutes to compile and upload each report. You must ensure that messages are successfully processed without exceeding Azure Queue Storage limits and that other instances of the background service do not attempt to process the same message concurrently. Which two actions should you perform? (Select two.)

  1. Upload the report request payload to Azure Blob Storage, and use the Blob URI as the queue message payload.Answer
  2. Call QueueClient.ReceiveMessagesAsync and specify a visibilityTimeout of at least 10 minutes.Answer
  3. C
    Initialize the QueueClient using QueueClientOptions with the maximum message size set to 256 KB.
  4. D
    Generate a Shared Access Signature (SAS) token for the queue with full Manage permissions to authorize the background service.
  5. E
    Retrieve the messages using QueueClient.PeekMessagesAsync to prevent the visibility timeout clock from starting during processing.

Answer

To resolve the limits and processing concurrency issues, you must upload the report request payload to Azure Blob Storage and use the Blob URI as the queue message payload, and call QueueClient.ReceiveMessagesAsync with a visibilityTimeout of at least 10 minutes.
The correct options are the ones that suggest uploading the payload to Azure Blob Storage and using the Blob URI as the queue message payload, and calling QueueClient.ReceiveMessagesAsync with a visibilityTimeout of at least 10 minutes. Storing the payload in Azure Blob Storage is necessary because Azure Queue Storage messages have a hard size limit of 64 KB, and the payload can reach 150 KB. Specifying a visibilityTimeout of 10 minutes ensures that the message remains invisible to other consumer instances while the background service processes the report, preventing duplicate processing.

Step-by-Step Solution

1
Address the 64 KB limit of Azure Queue Storage messages.
Since the payload can be 150 KB, store it in Azure Blob Storage and place only the URI link in the queue message.
This implements the Claim Check pattern to bypass the queue storage size limit.
2
Prevent duplicate concurrent processing for the 10-minute operation.
Call QueueClient.ReceiveMessagesAsync and specify a visibilityTimeout of 10 minutes or more.
The default visibility timeout is 30 seconds. Setting it to 10 minutes keeps the message invisible to other instances while it is being processed.

Key Concept

Handling large payloads and visibility timeouts in Azure Queue Storage
Rate this question