You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -179,13 +174,7 @@ using Microsoft.Azure.Storage.Queue; // Namespace for Queue storage types
179
174
180
175
The [QueueClient](/dotnet/api/azure.storage.queues.queueclient) class enables you to retrieve queues stored in Queue storage. Here's one way to create the service client:
To insert a message into an existing queue, call the [SendMessage](/dotnet/api/azure.storage.queues.queueclient.sendmessage) method. A can be either a `string` (in UTF-8 format) or a `byte` array. Here is code which creates a queue (if it doesn't exist) and inserts the message "Hello, World":
You can peek at the messages in the queue without removing them from the queue by calling the [PeekMessages](/dotnet/api/azure.storage.queues.queueclient.peekmessages) method. If you don't pass a value for the *maxResults* parameter, the default is to peek at one message.
Your code de-queues a message from a queue in two steps. When you call [ReceiveMessages](/dotnet/api/azure.storage.queues.queueclient.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](/dotnet/api/azure.storage.queues.queueclient.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.
323
+
De-queue a message from a queue in two steps. When you call [ReceiveMessages](/dotnet/api/azure.storage.queues.queueclient.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](/dotnet/api/azure.storage.queues.queueclient.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.
@@ -506,30 +395,7 @@ There are two ways you can customize message retrieval from a queue. First, you
506
395
507
396
The following code example uses the [ReceiveMessages](/dotnet/api/azure.storage.queues.queueclient.receivemessages) method to get 20 messages in one call. Then it processes each message using a `foreach` loop. It also sets the invisibility timeout to five minutes for each message. Note that the 5 minutes starts for all messages at the same time, so after 5 minutes have passed since the call to `ReceiveMessages`, any messages which have not been deleted will become visible again.
@@ -562,24 +428,7 @@ foreach (CloudQueueMessage message in queue.GetMessages(20, TimeSpan.FromMinutes
562
428
563
429
You can get an estimate of the number of messages in a queue. The [GetProperties](/dotnet/api/azure.storage.queues.queueclient.getproperties) method asks the Queue service to retrieve the queue properties, including the message count. The [ApproximateMessagesCount](/dotnet/api/azure.storage.queues.models.queueproperties.approximatemessagescount) property contains the approximate number of messages in the queue. This number is not lower than the actual number of messages in the queue, but could be higher.
@@ -614,19 +463,7 @@ Console.WriteLine("Number of messages in queue: " + cachedMessageCount);
614
463
615
464
To delete a queue and all the messages contained in it, call the [Delete](/dotnet/api/azure.storage.queues.queueclient.delete) method on the queue object.
0 commit comments