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
Copy file name to clipboardExpand all lines: articles/storage/queues/queues-v8-samples-java.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ This article shows code samples that use version 8 of the Azure Queue Storage cl
19
19
20
20
## Create a queue
21
21
22
-
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli#how-to-create-a-queue)
22
+
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli)
23
23
24
24
Add the following `import` directives:
25
25
@@ -58,7 +58,7 @@ catch (Exception e)
58
58
59
59
## Add a message to a queue
60
60
61
-
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli#how-to-add-a-message-to-a-queue)
61
+
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli)
62
62
63
63
To insert a message into an existing queue, first create a new `CloudQueueMessage`. Next, call the `addMessage` method. A `CloudQueueMessage` can be created from either a string (in UTF-8 format) or a byte array. The following code example creates a queue (if it doesn't exist) and inserts the message `Hello, World`.
64
64
@@ -91,7 +91,7 @@ catch (Exception e)
91
91
92
92
## Peek at the next message
93
93
94
-
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli#how-to-peek-at-the-next-message)
94
+
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli)
95
95
96
96
You can peek at the message in the front of a queue without removing it from the queue by calling `peekMessage`.
97
97
@@ -126,7 +126,7 @@ catch (Exception e)
126
126
127
127
## Change the contents of a queued message
128
128
129
-
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli#how-to-change-the-contents-of-a-queued-message)
129
+
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli)
130
130
131
131
The following code sample searches through the queue of messages, locates the first message content that matches `Hello, world`, modifies the message content, and exits.
132
132
@@ -210,7 +210,7 @@ catch (Exception e)
210
210
211
211
## Get the queue length
212
212
213
-
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli#how-to-get-the-queue-length)
213
+
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli)
214
214
215
215
The `downloadAttributes` method retrieves several values including the number of messages currently in a queue. The count is only approximate because messages can be added or removed after your request. The `getApproximateMessageCount` method returns the last value retrieved by the call to `downloadAttributes`, without calling Queue Storage.
216
216
@@ -245,7 +245,7 @@ catch (Exception e)
245
245
246
246
## Dequeue the next message
247
247
248
-
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli#how-to-dequeue-the-next-message)
248
+
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli)
249
249
250
250
Your code dequeues a message from a queue in two steps. When you call `retrieveMessage`, you get the next message in a queue. A message returned from `retrieveMessage` 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`. If your code fails to process a message, this two-step process ensures that you can get the same message and try again. Your code calls `deleteMessage` right after the message has been processed.
251
251
@@ -280,7 +280,7 @@ catch (Exception e)
280
280
281
281
## Additional options for dequeuing messages
282
282
283
-
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli#additional-options-for-dequeuing-messages)
283
+
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli)
284
284
285
285
The following code example uses the `retrieveMessages` method to get 20 messages in one call. Then it processes each message using a `for` loop. It also sets the invisibility timeout to five minutes (300 seconds) for each message. The timeout starts for all messages at the same time. When five minutes have passed since the call to `retrieveMessages`, any messages not deleted becomes visible again.
286
286
@@ -313,7 +313,7 @@ catch (Exception e)
313
313
314
314
## List the queues
315
315
316
-
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli#how-to-list-the-queues)
316
+
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli)
317
317
318
318
To obtain a list of the current queues, call the `CloudQueueClient.listQueues()` method, which returns a collection of `CloudQueue` objects.
319
319
@@ -344,7 +344,7 @@ catch (Exception e)
344
344
345
345
## Delete a queue
346
346
347
-
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli#how-to-delete-a-queue)
347
+
Related article: [Get started with Azure Queue Storage using Java](storage-quickstart-queues-java.md?tabs=powershell%2Cpasswordless%2Croles-azure-portal%2Cenvironment-variable-windows%2Csign-in-azure-cli)
348
348
349
349
To delete a queue and all the messages contained in it, call the `deleteIfExists` method on the `CloudQueue` object.
0 commit comments