Class QueueAsyncClient
Instantiating an Asynchronous Queue Client
 QueueAsyncClient client = new QueueClientBuilder()
     .connectionString("connectionstring")
     .endpoint("endpoint")
     .buildAsyncClient();
 
 
 View this for additional ways to construct the client.
- See Also:
 
- 
Method Summary
Modifier and TypeMethodDescriptionDeletes all messages in the queue.Deletes all messages in the queue.create()Creates a new queue.Creates a new queue.createIfNotExistsWithResponse(Map<String, String> metadata) Creates a new queue.createWithResponse(Map<String, String> metadata) Creates a new queue.delete()Permanently deletes the queue.Permanently deletes the queue if it exists.Permanently deletes the queue if it exists.deleteMessage(String messageId, String popReceipt) Deletes the specified message in the queuedeleteMessageWithResponse(String messageId, String popReceipt) Deletes the specified message in the queuePermanently deletes the queue.generateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues) Generates a service sas for the queue using the specifiedQueueServiceSasSignatureValuesgenerateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues, com.azure.core.util.Context context) Generates a service sas for the queue using the specifiedQueueServiceSasSignatureValuesgenerateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues, Consumer<String> stringToSignHandler, com.azure.core.util.Context context) Generates a service sas for the queue using the specifiedQueueServiceSasSignatureValuescom.azure.core.http.rest.PagedFlux<QueueSignedIdentifier> Retrieves stored access policies specified on the queue.Get associated account name.com.azure.core.http.HttpPipelineGets theHttpPipelinepowering this client.Gets the message encoding the client is using.Retrieves metadata and approximate message count of the queue.Mono<com.azure.core.http.rest.Response<QueueProperties>> Retrieves metadata and approximate message count of the queue.Get the queue name of the client.Get the URL of the storage queue.Gets the service version the client is using.Peeks the first message in the queue.com.azure.core.http.rest.PagedFlux<PeekedMessageItem> peekMessages(Integer maxMessages) Peek messages from the front of the queue up to the maximum number of messages.Retrieves the first message in the queue and hides it from other operations for 30 seconds.com.azure.core.http.rest.PagedFlux<QueueMessageItem> receiveMessages(Integer maxMessages) Retrieves up to the maximum number of messages from the queue and hides them from other operations for 30 seconds.com.azure.core.http.rest.PagedFlux<QueueMessageItem> receiveMessages(Integer maxMessages, Duration visibilityTimeout) Retrieves up to the maximum number of messages from the queue and hides them from other operations for the timeout period.sendMessage(com.azure.core.util.BinaryData message) Enqueues a message that has a time-to-live of 7 days and is instantly visible.sendMessage(String messageText) Enqueues a message that has a time-to-live of 7 days and is instantly visible.Mono<com.azure.core.http.rest.Response<SendMessageResult>> sendMessageWithResponse(com.azure.core.util.BinaryData message, Duration visibilityTimeout, Duration timeToLive) Enqueues a message with a given time-to-live and a timeout period where the message is invisible in the queue.Mono<com.azure.core.http.rest.Response<SendMessageResult>> sendMessageWithResponse(String messageText, Duration visibilityTimeout, Duration timeToLive) Enqueues a message with a given time-to-live and a timeout period where the message is invisible in the queue.setAccessPolicy(Iterable<QueueSignedIdentifier> permissions) Sets stored access policies on the queue.setAccessPolicyWithResponse(Iterable<QueueSignedIdentifier> permissions) Sets stored access policies on the queue.setMetadata(Map<String, String> metadata) Sets the metadata of the queue.setMetadataWithResponse(Map<String, String> metadata) Sets the metadata of the queue.updateMessage(String messageId, String popReceipt, String messageText, Duration visibilityTimeout) Updates the specific message in the queue with a new message and resets the visibility timeout.Mono<com.azure.core.http.rest.Response<UpdateMessageResult>> updateMessageWithResponse(String messageId, String popReceipt, String messageText, Duration visibilityTimeout) Updates the specific message in the queue with a new message and resets the visibility timeout. 
- 
Method Details
- 
getQueueUrl
Get the URL of the storage queue.- Returns:
 - the URL of the storage queue
 
 - 
getServiceVersion
Gets the service version the client is using.- Returns:
 - the service version the client is using.
 
 - 
getMessageEncoding
Gets the message encoding the client is using.- Returns:
 - the message encoding the client is using.
 
 - 
getHttpPipeline
public com.azure.core.http.HttpPipeline getHttpPipeline()Gets theHttpPipelinepowering this client.- Returns:
 - The pipeline.
 
 - 
create
Creates a new queue.Code Samples
Create a queue
client.create().subscribe( response -> { }, error -> System.err.print(error.toString()), () -> System.out.println("Complete creating the queue!") );For more information, see the Azure Docs.
- Returns:
 - An empty response
 - Throws:
 QueueStorageException- If a queue with the same name already exists in the queue service.
 - 
createWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> createWithResponse(Map<String, String> metadata) Creates a new queue.Code Samples
Create a queue with metadata "queue:metadataMap"
client.createWithResponse(Collections.singletonMap("queue", "metadataMap")).subscribe( response -> System.out.println("Complete creating the queue with status code:" + response.getStatusCode()), error -> System.err.print(error.toString()) );For more information, see the Azure Docs.
- Parameters:
 metadata- Metadata to associate with the queue. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.- Returns:
 - A response that only contains headers and response status code
 - Throws:
 QueueStorageException- If a queue with the same name and different metadata already exists in the queue service.
 - 
createIfNotExists
Creates a new queue.Code Samples
Create a queue
client.createIfNotExists().subscribe(created -> { if (created) { System.out.println("Successfully created."); } else { System.out.println("Already exists."); } });For more information, see the Azure Docs.
- Returns:
 - A reactive response signaling completion. 
trueindicates a new queue was created,falseindicates the specified queue already existed. 
 - 
createIfNotExistsWithResponse
public Mono<com.azure.core.http.rest.Response<Boolean>> createIfNotExistsWithResponse(Map<String, String> metadata) Creates a new queue.Code Samples
Create a queue with metadata "queue:metadataMap"
client.createIfNotExistsWithResponse(Collections.singletonMap("queue", "metadataMap")) .subscribe(response -> { if (response.getStatusCode() == 409) { System.out.println("Already exists."); } else { System.out.println("successfully created."); } });For more information, see the Azure Docs.
- Parameters:
 metadata- Metadata to associate with the queue. If there is leading or trailing whitespace in any metadata key or value, it must be removed or encoded.- Returns:
 - A reactive response signaling completion. If 
Response's status code is 201, a new queue was successfully created. If status code is 204 or 409, a queue already existed at this location. 
 - 
delete
Permanently deletes the queue.Code Samples
Delete a queue
client.delete().doOnSuccess( response -> System.out.println("Deleting the queue completed.") );For more information, see the Azure Docs.
- Returns:
 - An empty response
 - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
deleteWithResponse
Permanently deletes the queue.Code Samples
Delete a queue
client.deleteWithResponse().subscribe( response -> System.out.println("Deleting the queue completed with status code: " + response.getStatusCode()) );For more information, see the Azure Docs.
- Returns:
 - A response that only contains headers and response status code
 - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
deleteIfExists
Permanently deletes the queue if it exists.Code Samples
Delete a queue
client.deleteIfExists().subscribe(deleted -> { if (deleted) { System.out.println("Successfully deleted."); } else { System.out.println("Does not exist."); } });For more information, see the Azure Docs.
- Returns:
 - a reactive response signaling completion. 
trueindicates that the queue was successfully deleted,falseindicates that the queue did not exist. 
 - 
deleteIfExistsWithResponse
Permanently deletes the queue if it exists.Code Samples
Delete a queue
client.deleteIfExistsWithResponse().subscribe(response -> { if (response.getStatusCode() == 404) { System.out.println("Does not exist."); } else { System.out.println("successfully deleted."); } });For more information, see the Azure Docs.
- Returns:
 - A reactive response signaling completion. If 
Response's status code is 204, the queue was successfully deleted. If status code is 404, the queue does not exist. 
 - 
getProperties
Retrieves metadata and approximate message count of the queue.Code Samples
Get the properties of the queue
client.getProperties() .subscribe(properties -> { System.out.printf("Metadata: %s, Approximate message count: %d", properties.getMetadata(), properties.getApproximateMessagesCount()); });For more information, see the Azure Docs.
- Returns:
 - A response containing a 
QueuePropertiesvalue which contains the metadata and approximate messages count of the queue. - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
getPropertiesWithResponse
Retrieves metadata and approximate message count of the queue.Code Samples
Get the properties of the queue
client.getPropertiesWithResponse() .subscribe(response -> { QueueProperties properties = response.getValue(); System.out.printf("Metadata: %s, Approximate message count: %d", properties.getMetadata(), properties.getApproximateMessagesCount()); });For more information, see the Azure Docs.
- Returns:
 - A response containing a 
QueuePropertiesvalue which contains the metadata and approximate messages count of the queue. - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
setMetadata
Sets the metadata of the queue.Passing in a
nullvalue for metadata will clear the metadata associated with the queue.Code Samples
Set the queue's metadata to "queue:metadataMap"
client.setMetadata(Collections.singletonMap("queue", "metadataMap")) .subscribe(response -> System.out.println("Setting metadata completed."));Clear the queue's metadata
client.setMetadata(null) .subscribe(response -> System.out.println("Clearing metadata completed."));For more information, see the Azure Docs.
- Parameters:
 metadata- Metadata to set on the queue- Returns:
 - A response that only contains headers and response status code
 - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
setMetadataWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> setMetadataWithResponse(Map<String, String> metadata) Sets the metadata of the queue.Passing in a
nullvalue for metadata will clear the metadata associated with the queue.Code Samples
Set the queue's metadata to "queue:metadataMap"
client.setMetadataWithResponse(Collections.singletonMap("queue", "metadataMap")) .subscribe(response -> System.out.printf("Setting metadata completed with status code %d", response.getStatusCode()));Clear the queue's metadata
client.setMetadataWithResponse(null) .subscribe(response -> System.out.printf("Clearing metadata completed with status code %d", response.getStatusCode()));For more information, see the Azure Docs.
- Parameters:
 metadata- Metadata to set on the queue- Returns:
 - A response that only contains headers and response status code
 - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
getAccessPolicy
Retrieves stored access policies specified on the queue.Code Samples
List the stored access policies
client.getAccessPolicy() .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", result.getId(), result.getAccessPolicy().getPermissions()));For more information, see the Azure Docs.
- Returns:
 - The stored access policies specified on the queue.
 - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
setAccessPolicy
Sets stored access policies on the queue.Code Samples
Set a read only stored access policy
QueueAccessPolicy accessPolicy = new QueueAccessPolicy().setPermissions("r") .setStartsOn(OffsetDateTime.now(ZoneOffset.UTC)) .setExpiresOn(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); QueueSignedIdentifier permission = new QueueSignedIdentifier().setId("mypolicy").setAccessPolicy(accessPolicy); client.setAccessPolicy(Collections.singletonList(permission)) .subscribe(response -> System.out.println("Setting access policies completed."));For more information, see the Azure Docs.
- Parameters:
 permissions- Access policies to set on the queue- Returns:
 - An empty response
 - Throws:
 QueueStorageException- If the queue doesn't exist, a stored access policy doesn't have all fields filled out, or the queue will have more than five policies.
 - 
setAccessPolicyWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> setAccessPolicyWithResponse(Iterable<QueueSignedIdentifier> permissions) Sets stored access policies on the queue.Code Samples
Set a read only stored access policy
QueueAccessPolicy accessPolicy = new QueueAccessPolicy().setPermissions("r") .setStartsOn(OffsetDateTime.now(ZoneOffset.UTC)) .setExpiresOn(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); QueueSignedIdentifier permission = new QueueSignedIdentifier().setId("mypolicy").setAccessPolicy(accessPolicy); client.setAccessPolicyWithResponse(Collections.singletonList(permission)) .subscribe(response -> System.out.printf("Setting access policies completed with status code %d", response.getStatusCode()));For more information, see the Azure Docs.
- Parameters:
 permissions- Access policies to set on the queue- Returns:
 - A response that only contains headers and response status code
 - Throws:
 QueueStorageException- If the queue doesn't exist, a stored access policy doesn't have all fields filled out, or the queue will have more than five policies.
 - 
clearMessages
Deletes all messages in the queue.Code Samples
Clear the messages
client.clearMessages().subscribe( response -> System.out.println("Clearing messages completed."));For more information, see the Azure Docs.
- Returns:
 - An empty response
 - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
clearMessagesWithResponse
Deletes all messages in the queue.Code Samples
Clear the messages
client.clearMessagesWithResponse().doOnSuccess( response -> System.out.println("Clearing messages completed with status code: " + response.getStatusCode()) );For more information, see the Azure Docs.
- Returns:
 - A response that only contains headers and response status code
 - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
sendMessage
Enqueues a message that has a time-to-live of 7 days and is instantly visible.Code Samples
Enqueue a message of "Hello, Azure"
client.sendMessage("Hello, Azure").subscribe( response -> { }, error -> System.err.print(error.toString()), () -> System.out.println("Complete enqueuing the message!") );For more information, see the Azure Docs.
- Parameters:
 messageText- Message text- Returns:
 - A 
SendMessageResultvalue that contains themessageIdandpopReceiptthat are used to interact with the message and other metadata about the enqueued message. - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
sendMessage
Enqueues a message that has a time-to-live of 7 days and is instantly visible.Code Samples
Enqueue a message of "Hello, Azure"
client.sendMessage(BinaryData.fromString("Hello, Azure")).subscribe( response -> { }, error -> System.err.print(error.toString()), () -> System.out.println("Complete enqueuing the message!") );For more information, see the Azure Docs.
- Parameters:
 message- Message content- Returns:
 - A 
SendMessageResultvalue that contains themessageIdandpopReceiptthat are used to interact with the message and other metadata about the enqueued message. - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
sendMessageWithResponse
public Mono<com.azure.core.http.rest.Response<SendMessageResult>> sendMessageWithResponse(String messageText, Duration visibilityTimeout, Duration timeToLive) Enqueues a message with a given time-to-live and a timeout period where the message is invisible in the queue.Code Samples
Add a message of "Hello, Azure" that has a timeout of 5 seconds
client.sendMessageWithResponse("Hello, Azure", Duration.ofSeconds(5), null).subscribe( response -> System.out.printf("Message %s expires at %s", response.getValue().getMessageId(), response.getValue().getExpirationTime()), error -> System.err.print(error.toString()), () -> System.out.println("Complete enqueuing the message!") );Add a message of "Goodbye, Azure" that has a time to live of 5 seconds
client.sendMessageWithResponse("Goodbye, Azure", null, Duration.ofSeconds(5)).subscribe( response -> System.out.printf("Message %s expires at %s", response.getValue().getMessageId(), response.getValue().getExpirationTime()), error -> System.err.print(error.toString()), () -> System.out.println("Complete enqueuing the message!") );For more information, see the Azure Docs.
- Parameters:
 messageText- Message textvisibilityTimeout- Optional. The timeout period for how long the message is invisible in the queue. If unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0 seconds and 7 days.timeToLive- Optional. How long the message will stay alive in the queue. If unset the value will default to 7 days, ifDuration.ofSeconds(-1)is passed the message will not expire. The time to live must beDuration.ofSeconds(-1)or any positive number of seconds.- Returns:
 - A 
SendMessageResultvalue that contains themessageIdandpopReceiptthat are used to interact with the message and other metadata about the enqueued message. - Throws:
 QueueStorageException- If the queue doesn't exist or thevisibilityTimeoutortimeToLiveare outside the allowed limits.
 - 
sendMessageWithResponse
public Mono<com.azure.core.http.rest.Response<SendMessageResult>> sendMessageWithResponse(com.azure.core.util.BinaryData message, Duration visibilityTimeout, Duration timeToLive) Enqueues a message with a given time-to-live and a timeout period where the message is invisible in the queue.Code Samples
Add a message of "Hello, Azure" that has a timeout of 5 seconds
client.sendMessageWithResponse(BinaryData.fromString("Hello, Azure"), Duration.ofSeconds(5), null).subscribe( response -> System.out.printf("Message %s expires at %s", response.getValue().getMessageId(), response.getValue().getExpirationTime()), error -> System.err.print(error.toString()), () -> System.out.println("Complete enqueuing the message!") );Add a message of "Goodbye, Azure" that has a time to live of 5 seconds
client.sendMessageWithResponse(BinaryData.fromString("Goodbye, Azure"), null, Duration.ofSeconds(5)).subscribe( response -> System.out.printf("Message %s expires at %s", response.getValue().getMessageId(), response.getValue().getExpirationTime()), error -> System.err.print(error.toString()), () -> System.out.println("Complete enqueuing the message!") );For more information, see the Azure Docs.
- Parameters:
 message- Message content.visibilityTimeout- Optional. The timeout period for how long the message is invisible in the queue. If unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0 seconds and 7 days.timeToLive- Optional. How long the message will stay alive in the queue. If unset the value will default to 7 days, ifDuration.ofSeconds(-1)is passed the message will not expire. The time to live must beDuration.ofSeconds(-1)or any positive number of seconds.- Returns:
 - A 
SendMessageResultvalue that contains themessageIdandpopReceiptthat are used to interact with the message and other metadata about the enqueued message. - Throws:
 QueueStorageException- If the queue doesn't exist or thevisibilityTimeoutortimeToLiveare outside the allowed limits.
 - 
receiveMessage
Retrieves the first message in the queue and hides it from other operations for 30 seconds.Code Samples
Dequeue a message
client.receiveMessage().subscribe( message -> System.out.println("The message got from getMessages operation: " + message.getBody().toString()), error -> System.err.print(error.toString()), () -> System.out.println("Complete receiving the message!") );For more information, see the Azure Docs.
- Returns:
 - The first 
QueueMessageItemin the queue, it containsmessageIdandpopReceiptused to interact with the message, additionally it contains other metadata about the message. - Throws:
 QueueStorageException- If the queue doesn't exist
 - 
receiveMessages
Retrieves up to the maximum number of messages from the queue and hides them from other operations for 30 seconds.Code Samples
Dequeue up to 5 messages
client.receiveMessages(5).subscribe( message -> System.out.println("The message got from getMessages operation: " + message.getBody().toString()), error -> System.err.print(error.toString()), () -> System.out.println("Complete receiving the message!") );For more information, see the Azure Docs.
- Parameters:
 maxMessages- Optional. Maximum number of messages to get, if there are fewer messages exist in the queue than requested all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 messages.- Returns:
 - Up to 
maxMessagesReceiveMessageItemfrom the queue. Each DequeuedMessage containsmessageIdandpopReceiptused to interact with the message and other metadata about the message. - Throws:
 QueueStorageException- If the queue doesn't exist ormaxMessagesis outside the allowed bounds
 - 
receiveMessages
public com.azure.core.http.rest.PagedFlux<QueueMessageItem> receiveMessages(Integer maxMessages, Duration visibilityTimeout) Retrieves up to the maximum number of messages from the queue and hides them from other operations for the timeout period.Code Samples
Dequeue up to 5 messages and give them a 60 second timeout period
client.receiveMessages(5, Duration.ofSeconds(60)) .subscribe( message -> System.out.println("The message got from getMessages operation: " + message.getBody().toString()), error -> System.err.print(error.toString()), () -> System.out.println("Complete receiving the message!") );For more information, see the Azure Docs.
- Parameters:
 maxMessages- Optional. Maximum number of messages to get, if there are fewer messages exist in the queue than requested all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 messages.visibilityTimeout- Optional. The timeout period for how long the message is invisible in the queue. If left empty the dequeued messages will be invisible for 30 seconds. The timeout must be between 1 second and 7 days.- Returns:
 - Up to 
maxMessagesDequeuedMessagesfrom the queue. Each DeqeuedMessage containsmessageIdandpopReceiptused to interact with the message and other metadata about the message. - Throws:
 QueueStorageException- If the queue doesn't exist ormaxMessagesorvisibilityTimeoutis outside the allowed bounds
 - 
peekMessage
Peeks the first message in the queue.Peeked messages don't contain the necessary information needed to interact with the message nor will it hide messages from other operations on the queue.
Code Samples
Peek the first message
client.peekMessage().subscribe( peekMessages -> System.out.println("The message got from peek operation: " + peekMessages.getBody().toString()), error -> System.err.print(error.toString()), () -> System.out.println("Complete peeking the message!") );For more information, see the Azure Docs.
- Returns:
 - A 
PeekedMessageItemthat contains metadata about the message. 
 - 
peekMessages
Peek messages from the front of the queue up to the maximum number of messages.Peeked messages don't contain the necessary information needed to interact with the message nor will it hide messages from other operations on the queue.
Code Samples
Peek up to the first five messages
client.peekMessages(5).subscribe( peekMessage -> System.out.printf("Peeked message %s has been received %d times", peekMessage.getMessageId(), peekMessage.getDequeueCount()), error -> System.err.print(error.toString()), () -> System.out.println("Complete peeking the message!") );For more information, see the Azure Docs.
- Parameters:
 maxMessages- Optional. Maximum number of messages to peek, if there are fewer messages exist in the queue than requested all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is 1 to 32 messages.- Returns:
 - Up to 
maxMessagesPeekedMessagesfrom the queue. Each PeekedMessage contains metadata about the message. - Throws:
 QueueStorageException- If the queue doesn't exist ormaxMessagesis outside the allowed bounds
 - 
updateMessage
public Mono<UpdateMessageResult> updateMessage(String messageId, String popReceipt, String messageText, Duration visibilityTimeout) Updates the specific message in the queue with a new message and resets the visibility timeout.Code Samples
Dequeue the first message and update it to "Hello again, Azure" and hide it for 5 seconds
client.receiveMessage().subscribe( message -> { client.updateMessage("newText", message.getMessageId(), message.getPopReceipt(), null).subscribe( response -> { }, updateError -> System.err.print(updateError.toString()), () -> System.out.println("Complete updating the message!") ); }, error -> System.err.print(error.toString()), () -> System.out.println("Complete receiving the message!") );For more information, see the Azure Docs.
- Parameters:
 messageId- ID of the message to updatepopReceipt- Unique identifier that must match for the message to be updatedmessageText- Updated value for the messagevisibilityTimeout- The timeout period for how long the message is invisible in the queue in seconds. The timeout period must be between 1 second and 7 days. The default value is Duration.ZERO.- Returns:
 - A 
UpdateMessageResultthat contains the newpopReceiptto interact with the message, additionally contains the updated metadata about the message. - Throws:
 QueueStorageException- If the queue or messageId don't exist, the popReceipt doesn't match on the message, or thevisibilityTimeoutis outside the allowed bounds
 - 
updateMessageWithResponse
public Mono<com.azure.core.http.rest.Response<UpdateMessageResult>> updateMessageWithResponse(String messageId, String popReceipt, String messageText, Duration visibilityTimeout) Updates the specific message in the queue with a new message and resets the visibility timeout.Code Samples
Dequeue the first message and update it to "Hello again, Azure" and hide it for 5 seconds
client.receiveMessage().subscribe( message -> { client.updateMessageWithResponse(message.getMessageId(), message.getPopReceipt(), "newText", null).subscribe( response -> System.out.println("Complete updating the message with status code:" + response.getStatusCode()), updateError -> System.err.print(updateError.toString()), () -> System.out.println("Complete updating the message!") ); }, error -> System.err.print(error.toString()), () -> System.out.println("Complete receiving the message!") );For more information, see the Azure Docs.
- Parameters:
 messageId- ID of the message to updatepopReceipt- Unique identifier that must match for the message to be updatedmessageText- Updated value for the messagevisibilityTimeout- The timeout period for how long the message is invisible in the queue in seconds. The timeout period must be between 1 second and 7 days. The default value is Duration.ZERO.- Returns:
 - A 
UpdateMessageResultthat contains the newpopReceiptto interact with the message, additionally contains the updated metadata about the message. - Throws:
 QueueStorageException- If the queue or messageId don't exist, the popReceipt doesn't match on the message, or thevisibilityTimeoutis outside the allowed bounds
 - 
deleteMessage
Deletes the specified message in the queueCode Samples
Delete the first message
client.receiveMessage().subscribe( message -> { client.deleteMessage(message.getMessageId(), message.getPopReceipt()).subscribe( response -> { }, deleteError -> System.err.print(deleteError.toString()), () -> System.out.println("Complete deleting the message!") ); }, error -> System.err.print(error.toString()), () -> System.out.println("Complete receiving the message!") );For more information, see the Azure Docs.
- Parameters:
 messageId- ID of the message to deletedpopReceipt- Unique identifier that must match for the message to be deleted- Returns:
 - An empty response
 - Throws:
 QueueStorageException- If the queue or messageId don't exist or the popReceipt doesn't match on the message.
 - 
deleteMessageWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> deleteMessageWithResponse(String messageId, String popReceipt) Deletes the specified message in the queueCode Samples
Delete the first message
client.receiveMessage().subscribe( message -> { client.deleteMessageWithResponse(message.getMessageId(), message.getPopReceipt()) .subscribe( response -> System.out.println("Complete deleting the message with status code: " + response.getStatusCode()), deleteError -> System.err.print(deleteError.toString()), () -> System.out.println("Complete deleting the message!") ); }, error -> System.err.print(error.toString()), () -> System.out.println("Complete receiving the message!") );For more information, see the Azure Docs.
- Parameters:
 messageId- ID of the message to deletedpopReceipt- Unique identifier that must match for the message to be deleted- Returns:
 - A response that only contains headers and response status code
 - Throws:
 QueueStorageException- If the queue or messageId don't exist or the popReceipt doesn't match on the message.
 - 
getQueueName
Get the queue name of the client.Code Samples
String queueName = client.getQueueName(); System.out.println("The name of the queue is " + queueName);- Returns:
 - The name of the queue.
 
 - 
getAccountName
Get associated account name.- Returns:
 - account name associated with this storage resource.
 
 - 
generateSas
Generates a service sas for the queue using the specifiedQueueServiceSasSignatureValuesNote : The client must be authenticated via
StorageSharedKeyCredentialSee
QueueServiceSasSignatureValuesfor more information on how to construct a service SAS.Code Samples
OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); QueueSasPermission permission = new QueueSasPermission().setReadPermission(true); QueueServiceSasSignatureValues values = new QueueServiceSasSignatureValues(expiryTime, permission) .setStartTime(OffsetDateTime.now()); client.generateSas(values); // Client must be authenticated via StorageSharedKeyCredential- Parameters:
 queueServiceSasSignatureValues-QueueServiceSasSignatureValues- Returns:
 - A 
Stringrepresenting the SAS query parameters. 
 - 
generateSas
public String generateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues, com.azure.core.util.Context context) Generates a service sas for the queue using the specifiedQueueServiceSasSignatureValuesNote : The client must be authenticated via
StorageSharedKeyCredentialSee
QueueServiceSasSignatureValuesfor more information on how to construct a service SAS.Code Samples
OffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1); QueueSasPermission permission = new QueueSasPermission().setReadPermission(true); QueueServiceSasSignatureValues values = new QueueServiceSasSignatureValues(expiryTime, permission) .setStartTime(OffsetDateTime.now()); // Client must be authenticated via StorageSharedKeyCredential client.generateSas(values, new Context("key", "value"));- Parameters:
 queueServiceSasSignatureValues-QueueServiceSasSignatureValuescontext- Additional context that is passed through the code when generating a SAS.- Returns:
 - A 
Stringrepresenting the SAS query parameters. 
 - 
generateSas
public String generateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues, Consumer<String> stringToSignHandler, com.azure.core.util.Context context) Generates a service sas for the queue using the specifiedQueueServiceSasSignatureValuesNote : The client must be authenticated via
StorageSharedKeyCredentialSee
QueueServiceSasSignatureValuesfor more information on how to construct a service SAS.- Parameters:
 queueServiceSasSignatureValues-QueueServiceSasSignatureValuesstringToSignHandler- For debugging purposes only. Returns the string to sign that was used to generate the signature.context- Additional context that is passed through the code when generating a SAS.- Returns:
 - A 
Stringrepresenting the SAS query parameters. 
 
 -