Exam AZ-204 All QuestionsBrowse all questions from this exam
Question 280

HOTSPOT -

You are developing an application that uses Azure Storage Queues.

You have the following code:

For each of the following statements, select Yes if the statement is true. Otherwise, select No.

NOTE: Each correct selection is worth one point.

Hot Area:

    Correct Answer:

    Box 1: No -

    The QueueDescription.LockDuration property gets or sets the duration of a peek lock; that is, the amount of time that the message is locked for other receivers.

    The maximum value for LockDuration is 5 minutes; the default value is 1 minute.

    Box 2: Yes -

    You can peek at the message in the front of a queue without removing it from the queue by calling the PeekMessage method.

    Box 3: Yes -

    Reference:

    https://docs.microsoft.com/en-us/azure/storage/queues/storage-dotnet-how-to-use-queues https://docs.microsoft.com/en-us/dotnet/api/microsoft.servicebus.messaging.queuedescription.lockduration

Discussion
rajwit

Given answer is correct

igorole

GetMessageAsync: Gets a message from the queue using the default request options. This operation marks the retrieved message as invisible in the queue for the default visibility timeout period. Only marks the message is invisible but does not delete.

muggins

Thank you. Provided answer's reasoning for 'Yes' is incorrect.

1CY1

// To remove the message from the queue. CloudQueue queue = queueClient.GetQueueReference("myqueue"); // Async dequeue the message CloudQueueMessage retrievedMessage = await queue.GetMessageAsync(); Console.WriteLine("Retrieved message with content '{0}'", retrievedMessage.AsString); // Delete the message. await queue.DeleteMessageAsync(retrievedMessage);

paru123456789

Answer: No Yes Yes

xRiot007

No - we are not configuring anything here Yes - a message that is retrieved from a queue and not marked as completely processed will return to the same queue after a given amount of time, no matter if you use Peek or Get. Yes - the queue will stay there until we decide to delete it ourselves.

gematsaljoa

1. X 2. O 3. O

TaoLu

when you use the GetMessageAsync method to retrieve a message from an Azure Storage queue, the message is removed from the queue. If you want to retrieve a message without removing it from the queue, you can use the PeekMessageAsync method instead.

warchoon

This is not a simple Queue. This is another class that does not delete the message when it is read.

JVTM

2) explanation comments a peekMessage (which leave message in queue). But the last command is getMessageAsync() which reads the message out of the queue. So, it is not in queue anymore.

Magnetor

GetMessageAsync() does not qet out the message from the queue

thomas204

According to me you need to call DeleteMessageAsync() to remove the message from the queue.

ashuyop

thats right https://docs.microsoft.com/en-us/azure/storage/queues/storage-dotnet-how-to-use-queues?tabs=dotnet#de-queue-the-next-message

nonoss

Dequeue a message from a queue in two steps. When you call ReceiveMessages, you get the next message in a queue. A message returned from ReceiveMessages becomes invisible to any other code reading messages from this queue. By default, this message stays invisible for 30 seconds. To finish removing the message from the queue, you must also call DeleteMessage. This two-step process of removing a message assures that if your code fails to process a message due to hardware or software failure, another instance of your code can get the same message and try again. Your code calls DeleteMessage right after the message has been processed.

Miroshi

2nd answer is No https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.storage.queue.cloudqueue.getmessageasync?view=azure-dotnet-legacy You Take the msg after you peeked.

Netspud

Your link appears to imply that the message is not deleted unless additional params are included. Which would suggest the answer is as quoted, yes. (Not no as you suggest)

ReniRechner

peek: get the message, don't lock, don't delete get: get the message, lock the message (make it invisible for some seconds) delete: delete the message intention is: if get would also delete the message from the queue, an error in the function would render the message unhandled. Thus first get, process than delete. "at least handled once"

bhushan_786

Can someone confirm if the given answers are correct or not??

diligent176

They are correct, N, Y, Y. The code does not configure lock duration. The message will remain because GetMessageAsync does not remove it. The queue will also remain after execution.

igorole

Previous comment can be ignored, sorry, the right interface is here: https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.storage.queue.cloudqueue.getmessageasync?view=azure-dotnet-legacy

lagetronix

Given answer is correct

raymond_abcd

Given answer is correct. The GetMessage method is part of the peek-lock pattern. It retrieves a message without actually removing them from the queue until you explicitly complete, abandon, or dead-letter them.

OPT_001122

Given answer is correct

Yazhu

I dont understand here.. its a repetitive of 9th question.. its a copy paste question why diff answers? can someone clarify me?

Yazhu

commented in wrong window..sorry

nonoss

Box 3 : Correct answer https://docs.microsoft.com/en-us/azure/storage/queues/storage-dotnet-how-to-use-queues?tabs=dotnet#delete-a-queue

igorole

LastLine, GetMessageAsync() is not even part of the interface, this code just won't compile. https://docs.microsoft.com/en-us/dotnet/api/azure.storage.queues.queueclient?view=azure-dotnet

Kobee

You're wrong. It's CloudQueue, not QueueClient