### YamlMime:JavaType uid: "com.azure.storage.queue.QueueClient" fullName: "com.azure.storage.queue.QueueClient" name: "QueueClient" nameWithType: "QueueClient" summary: "This class provides a client that contains all the operations for interacting with a queue in Azure Storage Queue." inheritances: - "" inheritedClassMethods: - classRef: "java.lang.Object" methodsRef: - "clone" - "equals" - "finalize" - "getClass" - "hashCode" - "notify" - "notifyAll" - "toString" - "wait" - "wait" - "wait" syntax: "public final class **QueueClient**" methods: - uid: "com.azure.storage.queue.QueueClient.clearMessages()" fullName: "com.azure.storage.queue.QueueClient.clearMessages()" name: "clearMessages()" nameWithType: "QueueClient.clearMessages()" summary: "Deletes all messages in the queue." syntax: "public void clearMessages()" desc: "Deletes all messages in the queue.\n\n**Code Samples**\n\nClear the messages\n\n```java\nclient.clearMessages();\n System.out.println(\"Clearing messages completed.\");\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/clear-messages" - uid: "com.azure.storage.queue.QueueClient.clearMessagesWithResponse(java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.clearMessagesWithResponse(Duration timeout, Context context)" name: "clearMessagesWithResponse(Duration timeout, Context context)" nameWithType: "QueueClient.clearMessagesWithResponse(Duration timeout, Context context)" summary: "Deletes all messages in the queue." parameters: - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response clearMessagesWithResponse(Duration timeout, Context context)" desc: "Deletes all messages in the queue.\n\n**Code Samples**\n\nClear the messages\n\n```java\nResponse response = client.clearMessagesWithResponse(Duration.ofSeconds(1), new Context(key1, value1));\n System.out.printf(\"Clearing messages completed with status code %d\", response.getStatusCode());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/clear-messages" returns: description: "A response that only contains headers and response status code" type: "<Void>" - uid: "com.azure.storage.queue.QueueClient.create()" fullName: "com.azure.storage.queue.QueueClient.create()" name: "create()" nameWithType: "QueueClient.create()" summary: "Creates a new queue." syntax: "public void create()" desc: "Creates a new queue.\n\n**Code Samples**\n\nCreate a queue\n\n```java\nclient.create();\n System.out.println(\"Complete creating queue.\");\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/create-queue4" - uid: "com.azure.storage.queue.QueueClient.createIfNotExists()" fullName: "com.azure.storage.queue.QueueClient.createIfNotExists()" name: "createIfNotExists()" nameWithType: "QueueClient.createIfNotExists()" summary: "Creates a new queue if it does not exist." syntax: "public boolean createIfNotExists()" desc: "Creates a new queue if it does not exist.\n\n**Code Samples**\n\nCreate a queue\n\n```java\nboolean result = client.createIfNotExists();\n System.out.println(\"Queue created: \" + result);\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/create-queue4" returns: description: "true if queue is successfully created, false if queue already exists." type: "" - uid: "com.azure.storage.queue.QueueClient.createIfNotExistsWithResponse(java.util.Map,java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.createIfNotExistsWithResponse(Map metadata, Duration timeout, Context context)" name: "createIfNotExistsWithResponse(Map metadata, Duration timeout, Context context)" nameWithType: "QueueClient.createIfNotExistsWithResponse(Map metadata, Duration timeout, Context context)" summary: "Creates a new queue if it does not exist." parameters: - description: "Metadata to associate with the queue. If there is leading or trailing whitespace in any\n metadata key or value, it must be removed or encoded." name: "metadata" type: "Map<String,String>" - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response createIfNotExistsWithResponse(Map metadata, Duration timeout, Context context)" desc: "Creates a new queue if it does not exist.\n\n**Code Samples**\n\nCreate a queue with metadata \"queue:metadataMap\"\n\n```java\nResponse response = client.createIfNotExistsWithResponse(Collections.singletonMap(\"queue\", \"metadataMap\"),\n Duration.ofSeconds(1), new Context(key1, value1));\n if (response.getStatusCode() == 409) {\n System.out.println(\"Already existed.\");\n } else {\n System.out.printf(\"Create completed with status %d%n\", response.getStatusCode());\n }\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/create-queue4" returns: description: "A response containing status code and HTTP headers. If 's status code is 201, a new\n queue was successfully created. If status code is 204 or 409, a queue already existed at this location." type: "<Boolean>" - uid: "com.azure.storage.queue.QueueClient.createWithResponse(java.util.Map,java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.createWithResponse(Map metadata, Duration timeout, Context context)" name: "createWithResponse(Map metadata, Duration timeout, Context context)" nameWithType: "QueueClient.createWithResponse(Map metadata, Duration timeout, Context context)" summary: "Creates a new queue." parameters: - description: "Metadata to associate with the queue. If there is leading or trailing whitespace in any\n metadata key or value, it must be removed or encoded." name: "metadata" type: "Map<String,String>" - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response createWithResponse(Map metadata, Duration timeout, Context context)" desc: "Creates a new queue.\n\n**Code Samples**\n\nCreate a queue with metadata \"queue:metadataMap\"\n\n```java\nResponse response = client.createWithResponse(Collections.singletonMap(\"queue\", \"metadataMap\"),\n Duration.ofSeconds(1), new Context(key1, value1));\n System.out.println(\"Complete creating queue with status code: \" + response.getStatusCode());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/create-queue4" returns: description: "A response that only contains headers and response status code" type: "<Void>" - uid: "com.azure.storage.queue.QueueClient.delete()" fullName: "com.azure.storage.queue.QueueClient.delete()" name: "delete()" nameWithType: "QueueClient.delete()" summary: "Permanently deletes the queue." syntax: "public void delete()" desc: "Permanently deletes the queue.\n\n**Code Samples**\n\nDelete a queue\n\n```java\nclient.delete();\n System.out.println(\"Complete deleting the queue.\");\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/delete-queue3" - uid: "com.azure.storage.queue.QueueClient.deleteIfExists()" fullName: "com.azure.storage.queue.QueueClient.deleteIfExists()" name: "deleteIfExists()" nameWithType: "QueueClient.deleteIfExists()" summary: "Permanently deletes the queue if exists." syntax: "public boolean deleteIfExists()" desc: "Permanently deletes the queue if exists.\n\n**Code Samples**\n\nDelete a queue\n\n```java\nclient.deleteIfExists();\n System.out.println(\"Complete deleting the queue.\");\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/delete-queue3" returns: description: "true if queue is successfully deleted, false if queue does not exist." type: "" - uid: "com.azure.storage.queue.QueueClient.deleteIfExistsWithResponse(java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.deleteIfExistsWithResponse(Duration timeout, Context context)" name: "deleteIfExistsWithResponse(Duration timeout, Context context)" nameWithType: "QueueClient.deleteIfExistsWithResponse(Duration timeout, Context context)" summary: "Permanently deletes the queue if it exists." parameters: - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response deleteIfExistsWithResponse(Duration timeout, Context context)" desc: "Permanently deletes the queue if it exists.\n\n**Code Samples**\n\nDelete a queue\n\n```java\nResponse response = client.deleteIfExistsWithResponse(Duration.ofSeconds(1), new Context(key1, value1));\n if (response.getStatusCode() == 404) {\n System.out.println(\"Does not exist.\");\n } else {\n System.out.printf(\"Delete completed with status %d%n\", response.getStatusCode());\n }\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/delete-queue3" returns: description: "A response containing status code and HTTP headers. If 's status code is 204, the queue\n was successfully deleted. If status code is 404, the queue does not exist." type: "<Boolean>" - uid: "com.azure.storage.queue.QueueClient.deleteMessage(java.lang.String,java.lang.String)" fullName: "com.azure.storage.queue.QueueClient.deleteMessage(String messageId, String popReceipt)" name: "deleteMessage(String messageId, String popReceipt)" nameWithType: "QueueClient.deleteMessage(String messageId, String popReceipt)" summary: "Deletes the specified message in the queue" parameters: - description: "Id of the message to deleted" name: "messageId" type: "String" - description: "Unique identifier that must match for the message to be deleted" name: "popReceipt" type: "String" syntax: "public void deleteMessage(String messageId, String popReceipt)" desc: "Deletes the specified message in the queue\n\n**Code Samples**\n\nDelete the first message\n\n```java\nQueueMessageItem queueMessageItem = client.receiveMessage();\n client.deleteMessage(queueMessageItem.getMessageId(), queueMessageItem.getPopReceipt());\n System.out.println(\"Complete deleting the message.\");\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/delete-message2" - uid: "com.azure.storage.queue.QueueClient.deleteMessageWithResponse(java.lang.String,java.lang.String,java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.deleteMessageWithResponse(String messageId, String popReceipt, Duration timeout, Context context)" name: "deleteMessageWithResponse(String messageId, String popReceipt, Duration timeout, Context context)" nameWithType: "QueueClient.deleteMessageWithResponse(String messageId, String popReceipt, Duration timeout, Context context)" summary: "Deletes the specified message in the queue" parameters: - description: "Id of the message to deleted" name: "messageId" type: "String" - description: "Unique identifier that must match for the message to be deleted" name: "popReceipt" type: "String" - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response deleteMessageWithResponse(String messageId, String popReceipt, Duration timeout, Context context)" desc: "Deletes the specified message in the queue\n\n**Code Samples**\n\nDelete the first message\n\n```java\nQueueMessageItem queueMessageItem = client.receiveMessage();\n Response response = client.deleteMessageWithResponse(queueMessageItem.getMessageId(),\n queueMessageItem.getPopReceipt(), Duration.ofSeconds(1), new Context(key1, value1));\n System.out.println(\"Complete deleting the message with status code \" + response.getStatusCode());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/delete-message2" returns: description: "A response that only contains headers and response status code" type: "<Void>" - uid: "com.azure.storage.queue.QueueClient.deleteWithResponse(java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.deleteWithResponse(Duration timeout, Context context)" name: "deleteWithResponse(Duration timeout, Context context)" nameWithType: "QueueClient.deleteWithResponse(Duration timeout, Context context)" summary: "Permanently deletes the queue." parameters: - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response deleteWithResponse(Duration timeout, Context context)" desc: "Permanently deletes the queue.\n\n**Code Samples**\n\nDelete a queue\n\n```java\nResponse response = client.deleteWithResponse(Duration.ofSeconds(1), new Context(key1, value1));\n System.out.println(\"Complete deleting the queue with status code: \" + response.getStatusCode());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/delete-queue3" returns: description: "A response that only contains headers and response status code" type: "<Void>" - uid: "com.azure.storage.queue.QueueClient.generateSas(com.azure.storage.queue.sas.QueueServiceSasSignatureValues)" fullName: "com.azure.storage.queue.QueueClient.generateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues)" name: "generateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues)" nameWithType: "QueueClient.generateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues)" summary: "Generates a service sas for the queue using the specified " parameters: - description: "" name: "queueServiceSasSignatureValues" type: "" syntax: "public String generateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues)" desc: "Generates a service sas for the queue using the specified \n\nNote : The client must be authenticated via \n\nSee for more information on how to construct a service SAS.\n\n**Code Samples**\n\n```java\nOffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);\n QueueSasPermission permission = new QueueSasPermission().setReadPermission(true);\n\n QueueServiceSasSignatureValues values = new QueueServiceSasSignatureValues(expiryTime, permission)\n .setStartTime(OffsetDateTime.now());\n\n client.generateSas(values); // Client must be authenticated via StorageSharedKeyCredential\n```" returns: description: "A String representing the SAS query parameters." type: "String" - uid: "com.azure.storage.queue.QueueClient.generateSas(com.azure.storage.queue.sas.QueueServiceSasSignatureValues,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.generateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues, Context context)" name: "generateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues, Context context)" nameWithType: "QueueClient.generateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues, Context context)" summary: "Generates a service sas for the queue using the specified " parameters: - description: "" name: "queueServiceSasSignatureValues" type: "" - description: "Additional context that is passed through the code when generating a SAS." name: "context" type: "" syntax: "public String generateSas(QueueServiceSasSignatureValues queueServiceSasSignatureValues, Context context)" desc: "Generates a service sas for the queue using the specified \n\nNote : The client must be authenticated via \n\nSee for more information on how to construct a service SAS.\n\n**Code Samples**\n\n```java\nOffsetDateTime expiryTime = OffsetDateTime.now().plusDays(1);\n QueueSasPermission permission = new QueueSasPermission().setReadPermission(true);\n\n QueueServiceSasSignatureValues values = new QueueServiceSasSignatureValues(expiryTime, permission)\n .setStartTime(OffsetDateTime.now());\n\n // Client must be authenticated via StorageSharedKeyCredential\n client.generateSas(values, new Context(\"key\", \"value\"));\n```" returns: description: "A String representing the SAS query parameters." type: "String" - uid: "com.azure.storage.queue.QueueClient.getAccessPolicy()" fullName: "com.azure.storage.queue.QueueClient.getAccessPolicy()" name: "getAccessPolicy()" nameWithType: "QueueClient.getAccessPolicy()" summary: "Retrieves stored access policies specified on the queue." syntax: "public PagedIterable getAccessPolicy()" desc: "Retrieves stored access policies specified on the queue.\n\n**Code Samples**\n\nList the stored access policies\n\n```java\nfor (QueueSignedIdentifier permission : client.getAccessPolicy()) {\n System.out.printf(\"Access policy %s allows these permissions: %s\", permission.getId(),\n permission.getAccessPolicy().getPermissions());\n }\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/get-queue-acl" returns: description: "The stored access policies specified on the queue." type: "<>" - uid: "com.azure.storage.queue.QueueClient.getAccountName()" fullName: "com.azure.storage.queue.QueueClient.getAccountName()" name: "getAccountName()" nameWithType: "QueueClient.getAccountName()" summary: "Get associated account name." syntax: "public String getAccountName()" desc: "Get associated account name." returns: description: "account name associated with this storage resource." type: "String" - uid: "com.azure.storage.queue.QueueClient.getHttpPipeline()" fullName: "com.azure.storage.queue.QueueClient.getHttpPipeline()" name: "getHttpPipeline()" nameWithType: "QueueClient.getHttpPipeline()" summary: "Gets the powering this client." syntax: "public HttpPipeline getHttpPipeline()" desc: "Gets the powering this client." returns: description: "The pipeline." type: "" - uid: "com.azure.storage.queue.QueueClient.getMessageEncoding()" fullName: "com.azure.storage.queue.QueueClient.getMessageEncoding()" name: "getMessageEncoding()" nameWithType: "QueueClient.getMessageEncoding()" summary: "Gets the message encoding the client is using." syntax: "public QueueMessageEncoding getMessageEncoding()" desc: "Gets the message encoding the client is using." returns: description: "the message encoding the client is using." type: "" - uid: "com.azure.storage.queue.QueueClient.getProperties()" fullName: "com.azure.storage.queue.QueueClient.getProperties()" name: "getProperties()" nameWithType: "QueueClient.getProperties()" summary: "Retrieves metadata and approximate message count of the queue." syntax: "public QueueProperties getProperties()" desc: "Retrieves metadata and approximate message count of the queue.\n\n**Code Samples**\n\nGet the properties of the queue\n\n```java\nQueueProperties properties = client.getProperties();\n System.out.printf(\"Metadata: %s, Approximate message count: %d\", properties.getMetadata(),\n properties.getApproximateMessagesCount());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/get-queue-metadata" returns: description: "A response containing a value which contains the metadata and approximate\n messages count of the queue." type: "" - uid: "com.azure.storage.queue.QueueClient.getPropertiesWithResponse(java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.getPropertiesWithResponse(Duration timeout, Context context)" name: "getPropertiesWithResponse(Duration timeout, Context context)" nameWithType: "QueueClient.getPropertiesWithResponse(Duration timeout, Context context)" summary: "Retrieves metadata and approximate message count of the queue." parameters: - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response getPropertiesWithResponse(Duration timeout, Context context)" desc: "Retrieves metadata and approximate message count of the queue.\n\n**Code Samples**\n\nGet the properties of the queue\n\n```java\nQueueProperties properties = client.getPropertiesWithResponse(Duration.ofSeconds(1),\n new Context(key1, value1)).getValue();\n System.out.printf(\"Metadata: %s, Approximate message count: %d\", properties.getMetadata(),\n properties.getApproximateMessagesCount());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/get-queue-metadata" returns: description: "A response containing a value which contains the metadata and approximate\n messages count of the queue." type: "<>" - uid: "com.azure.storage.queue.QueueClient.getQueueName()" fullName: "com.azure.storage.queue.QueueClient.getQueueName()" name: "getQueueName()" nameWithType: "QueueClient.getQueueName()" summary: "Get the queue name of the client." syntax: "public String getQueueName()" desc: "Get the queue name of the client.\n\n**Code Samples**\n\n```java\nString queueName = client.getQueueName();\n System.out.println(\"The name of the queue is \" + queueName);\n```" returns: description: "The name of the queue." type: "String" - uid: "com.azure.storage.queue.QueueClient.getQueueUrl()" fullName: "com.azure.storage.queue.QueueClient.getQueueUrl()" name: "getQueueUrl()" nameWithType: "QueueClient.getQueueUrl()" summary: "Get the URL of the storage queue." syntax: "public String getQueueUrl()" desc: "Get the URL of the storage queue." returns: description: "the URL of the storage queue." type: "String" - uid: "com.azure.storage.queue.QueueClient.getServiceVersion()" fullName: "com.azure.storage.queue.QueueClient.getServiceVersion()" name: "getServiceVersion()" nameWithType: "QueueClient.getServiceVersion()" summary: "Gets the service version the client is using." syntax: "public QueueServiceVersion getServiceVersion()" desc: "Gets the service version the client is using." returns: description: "the service version the client is using." type: "" - uid: "com.azure.storage.queue.QueueClient.peekMessage()" fullName: "com.azure.storage.queue.QueueClient.peekMessage()" name: "peekMessage()" nameWithType: "QueueClient.peekMessage()" summary: "Peeks the first message in the queue." syntax: "public PeekedMessageItem peekMessage()" desc: "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.\n\n**Code Samples**\n\nPeek the first message\n\n```java\nPeekedMessageItem peekedMessageItem = client.peekMessage();\n System.out.println(\"Complete peeking the message: \" + peekedMessageItem.getBody().toString());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/peek-messages" returns: description: "A that contains metadata about the message." type: "" - uid: "com.azure.storage.queue.QueueClient.peekMessages(java.lang.Integer,java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.peekMessages(Integer maxMessages, Duration timeout, Context context)" name: "peekMessages(Integer maxMessages, Duration timeout, Context context)" nameWithType: "QueueClient.peekMessages(Integer maxMessages, Duration timeout, Context context)" summary: "Peek messages from the front of the queue up to the maximum number of messages." parameters: - description: "Optional. Maximum number of messages to peek, if there are less messages exist in the queue\n than requested all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is\n 1 to 32 messages." name: "maxMessages" type: "Integer" - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public PagedIterable peekMessages(Integer maxMessages, Duration timeout, Context context)" desc: "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.\n\n**Code Samples**\n\nPeek up to the first five messages\n\n```java\nclient.peekMessages(5, Duration.ofSeconds(1), new Context(key1, value1)).forEach(\n peekMessage -> System.out.printf(\"Peeked message %s has been received %d times\",\n peekMessage.getMessageId(), peekMessage.getDequeueCount())\n );\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/peek-messages" returns: description: "Up to maxMessages from the queue. Each PeekedMessage\n contains metadata about the message." type: "<>" - uid: "com.azure.storage.queue.QueueClient.receiveMessage()" fullName: "com.azure.storage.queue.QueueClient.receiveMessage()" name: "receiveMessage()" nameWithType: "QueueClient.receiveMessage()" summary: "Retrieves the first message in the queue and hides it from other operations for 30 seconds." syntax: "public QueueMessageItem receiveMessage()" desc: "Retrieves the first message in the queue and hides it from other operations for 30 seconds.\n\n**Code Samples**\n\nReceive a message\n\n```java\nQueueMessageItem queueMessageItem = client.receiveMessage();\n System.out.println(\"Complete receiving the message: \" + queueMessageItem.getMessageId());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/get-messages" returns: description: "The first in the queue, it contains\n and\n used to interact with the message,\n additionally it contains other metadata about the message." type: "" - uid: "com.azure.storage.queue.QueueClient.receiveMessages(java.lang.Integer)" fullName: "com.azure.storage.queue.QueueClient.receiveMessages(Integer maxMessages)" name: "receiveMessages(Integer maxMessages)" nameWithType: "QueueClient.receiveMessages(Integer maxMessages)" summary: "Retrieves up to the maximum number of messages from the queue and hides them from other operations for 30 seconds." parameters: - description: "Optional. Maximum number of messages to get, if there are less messages exist in the queue\n than requested all the messages will be returned. If left empty only 1 message will be retrieved, the allowed\n range is 1 to 32 messages." name: "maxMessages" type: "Integer" syntax: "public PagedIterable receiveMessages(Integer maxMessages)" desc: "Retrieves up to the maximum number of messages from the queue and hides them from other operations for 30 seconds.\n\n**Code Samples**\n\nReceive up to 5 messages\n\n```java\nfor (QueueMessageItem message : client.receiveMessages(5)) {\n System.out.printf(\"Received %s and it becomes visible at %s\",\n message.getMessageId(), message.getTimeNextVisible());\n }\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/get-messages" returns: description: "Up to maxMessages from the queue.\n Each ReceiveMessageItem contains and\n \n used to interact with the message and other metadata about the message." type: "<>" - uid: "com.azure.storage.queue.QueueClient.receiveMessages(java.lang.Integer,java.time.Duration,java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.receiveMessages(Integer maxMessages, Duration visibilityTimeout, Duration timeout, Context context)" name: "receiveMessages(Integer maxMessages, Duration visibilityTimeout, Duration timeout, Context context)" nameWithType: "QueueClient.receiveMessages(Integer maxMessages, Duration visibilityTimeout, Duration timeout, Context context)" summary: "Retrieves up to the maximum number of messages from the queue and hides them from other operations for the timeout period." parameters: - description: "Optional. Maximum number of messages to get, if there are less messages exist in the queue\n than requested all the messages will be returned. If left empty only 1 message will be retrieved, the allowed\n range is 1 to 32 messages." name: "maxMessages" type: "Integer" - description: "Optional. The timeout period for how long the message is invisible in the queue. If left\n empty the received messages will be invisible for 30 seconds. The timeout must be between 1 second and 7 days." name: "visibilityTimeout" type: "Duration" - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public PagedIterable receiveMessages(Integer maxMessages, Duration visibilityTimeout, Duration timeout, Context context)" desc: "Retrieves up to the maximum number of messages from the queue and hides them from other operations for the timeout period.\n\n**Code Samples**\n\nReceive up to 5 messages and give them a 60 second timeout period\n\n```java\nfor (QueueMessageItem message : client.receiveMessages(5, Duration.ofSeconds(60),\n Duration.ofSeconds(1), new Context(key1, value1))) {\n System.out.printf(\"Received %s and it becomes visible at %s\",\n message.getMessageId(), message.getTimeNextVisible());\n }\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/get-messages" returns: description: "Up to maxMessages from the queue. Each DeqeuedMessage\n contains and\n \n used to interact with the message and other metadata about the message." type: "<>" - uid: "com.azure.storage.queue.QueueClient.sendMessage(com.azure.core.util.BinaryData)" fullName: "com.azure.storage.queue.QueueClient.sendMessage(BinaryData message)" name: "sendMessage(BinaryData message)" nameWithType: "QueueClient.sendMessage(BinaryData message)" summary: "Sends a message that has a time-to-live of 7 days and is instantly visible." parameters: - description: "Message content" name: "message" type: "" syntax: "public SendMessageResult sendMessage(BinaryData message)" desc: "Sends a message that has a time-to-live of 7 days and is instantly visible.\n\n**Code Samples**\n\nSends a message of \"Hello, Azure\"\n\n```java\nSendMessageResult response = client.sendMessage(BinaryData.fromString(\"Hello msg\"));\n System.out.println(\"Complete enqueuing the message with message Id\" + response.getMessageId());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/put-message" returns: description: "A value that contains the \n and that are used to interact with the message\n and other metadata about the enqueued message." type: "" - uid: "com.azure.storage.queue.QueueClient.sendMessage(java.lang.String)" fullName: "com.azure.storage.queue.QueueClient.sendMessage(String messageText)" name: "sendMessage(String messageText)" nameWithType: "QueueClient.sendMessage(String messageText)" summary: "Sends a message that has a time-to-live of 7 days and is instantly visible." parameters: - description: "Message text" name: "messageText" type: "String" syntax: "public SendMessageResult sendMessage(String messageText)" desc: "Sends a message that has a time-to-live of 7 days and is instantly visible.\n\n**Code Samples**\n\nSends a message of \"Hello, Azure\"\n\n```java\nSendMessageResult response = client.sendMessage(\"hello msg\");\n System.out.println(\"Complete enqueuing the message with message Id\" + response.getMessageId());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/put-message" returns: description: "A value that contains the \n and that are used to interact with the message\n and other metadata about the enqueued message." type: "" - uid: "com.azure.storage.queue.QueueClient.sendMessageWithResponse(com.azure.core.util.BinaryData,java.time.Duration,java.time.Duration,java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.sendMessageWithResponse(BinaryData message, Duration visibilityTimeout, Duration timeToLive, Duration timeout, Context context)" name: "sendMessageWithResponse(BinaryData message, Duration visibilityTimeout, Duration timeToLive, Duration timeout, Context context)" nameWithType: "QueueClient.sendMessageWithResponse(BinaryData message, Duration visibilityTimeout, Duration timeToLive, Duration timeout, Context context)" summary: "Sends a message with a given time-to-live and a timeout period where the message is invisible in the queue." parameters: - description: "Message content" name: "message" type: "" - description: "Optional. The timeout period for how long the message is invisible in the queue. If\n unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0\n seconds and 7 days." name: "visibilityTimeout" type: "Duration" - description: "Optional. How long the message will stay alive in the queue. If unset the value will default to\n 7 days, if Duration.ofSeconds(-1) is passed the message will not expire.\n The time to live must be Duration.ofSeconds(-1) or any positive number of seconds." name: "timeToLive" type: "Duration" - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response sendMessageWithResponse(BinaryData message, Duration visibilityTimeout, Duration timeToLive, Duration timeout, Context context)" desc: "Sends a message with a given time-to-live and a timeout period where the message is invisible in the queue.\n\n**Code Samples**\n\nAdd a message of \"Hello, Azure\" that has a timeout of 5 seconds\n\n```java\nSendMessageResult sentMessageItem = client.sendMessageWithResponse(BinaryData.fromString(\"Hello, Azure\"),\n Duration.ofSeconds(5), null, Duration.ofSeconds(1), new Context(key1, value1)).getValue();\n System.out.printf(\"Message %s expires at %s\", sentMessageItem.getMessageId(),\n sentMessageItem.getExpirationTime());\n```\n\nAdd a message of \"Goodbye, Azure\" that has a time to live of 5 seconds\n\n```java\nSendMessageResult enqueuedMessage = client.sendMessageWithResponse(BinaryData.fromString(\"Goodbye, Azure\"),\n null, Duration.ofSeconds(5), Duration.ofSeconds(1), new Context(key1, value1)).getValue();\n System.out.printf(\"Message %s expires at %s\", enqueuedMessage.getMessageId(),\n enqueuedMessage.getExpirationTime());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/put-message" returns: description: "A response containing the value that contains the\n and\n that are used to\n interact with the message and other metadata about the enqueued message." type: "<>" - uid: "com.azure.storage.queue.QueueClient.sendMessageWithResponse(java.lang.String,java.time.Duration,java.time.Duration,java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.sendMessageWithResponse(String messageText, Duration visibilityTimeout, Duration timeToLive, Duration timeout, Context context)" name: "sendMessageWithResponse(String messageText, Duration visibilityTimeout, Duration timeToLive, Duration timeout, Context context)" nameWithType: "QueueClient.sendMessageWithResponse(String messageText, Duration visibilityTimeout, Duration timeToLive, Duration timeout, Context context)" summary: "Sends a message with a given time-to-live and a timeout period where the message is invisible in the queue." parameters: - description: "Message text" name: "messageText" type: "String" - description: "Optional. The timeout period for how long the message is invisible in the queue. If\n unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0\n seconds and 7 days." name: "visibilityTimeout" type: "Duration" - description: "Optional. How long the message will stay alive in the queue. If unset the value will default to\n 7 days, if Duration.ofSeconds(-1) is passed the message will not expire.\n The time to live must be Duration.ofSeconds(-1) or any positive number of seconds." name: "timeToLive" type: "Duration" - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response sendMessageWithResponse(String messageText, Duration visibilityTimeout, Duration timeToLive, Duration timeout, Context context)" desc: "Sends a message with a given time-to-live and a timeout period where the message is invisible in the queue.\n\n**Code Samples**\n\nAdd a message of \"Hello, Azure\" that has a timeout of 5 seconds\n\n```java\nSendMessageResult sentMessageItem = client.sendMessageWithResponse(\"Hello, Azure\",\n Duration.ofSeconds(5), null, Duration.ofSeconds(1), new Context(key1, value1)).getValue();\n System.out.printf(\"Message %s expires at %s\", sentMessageItem.getMessageId(),\n sentMessageItem.getExpirationTime());\n```\n\nAdd a message of \"Goodbye, Azure\" that has a time to live of 5 seconds\n\n```java\nSendMessageResult enqueuedMessage = client.sendMessageWithResponse(\"Goodbye, Azure\",\n null, Duration.ofSeconds(5), Duration.ofSeconds(1), new Context(key1, value1)).getValue();\n System.out.printf(\"Message %s expires at %s\", enqueuedMessage.getMessageId(),\n enqueuedMessage.getExpirationTime());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/put-message" returns: description: "A response containing the value that contains the\n and\n that are used to\n interact with the message and other metadata about the enqueued message." type: "<>" - uid: "com.azure.storage.queue.QueueClient.setAccessPolicy(java.util.List)" fullName: "com.azure.storage.queue.QueueClient.setAccessPolicy(List permissions)" name: "setAccessPolicy(List permissions)" nameWithType: "QueueClient.setAccessPolicy(List permissions)" summary: "Sets stored access policies on the queue." parameters: - description: "Access policies to set on the queue" name: "permissions" type: "List<>" syntax: "public void setAccessPolicy(List permissions)" desc: "Sets stored access policies on the queue.\n\n**Code Samples**\n\nSet a read only stored access policy\n\n```java\nQueueAccessPolicy accessPolicy = new QueueAccessPolicy().setPermissions(\"r\")\n .setStartsOn(OffsetDateTime.now(ZoneOffset.UTC))\n .setExpiresOn(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10));\n QueueSignedIdentifier permission = new QueueSignedIdentifier().setId(\"mypolicy\").setAccessPolicy(accessPolicy);\n client.setAccessPolicy(Collections.singletonList(permission));\n System.out.println(\"Setting access policies completed.\");\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/set-queue-acl" - uid: "com.azure.storage.queue.QueueClient.setAccessPolicyWithResponse(java.util.List,java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.setAccessPolicyWithResponse(List permissions, Duration timeout, Context context)" name: "setAccessPolicyWithResponse(List permissions, Duration timeout, Context context)" nameWithType: "QueueClient.setAccessPolicyWithResponse(List permissions, Duration timeout, Context context)" summary: "Sets stored access policies on the queue." parameters: - description: "Access policies to set on the queue" name: "permissions" type: "List<>" - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response setAccessPolicyWithResponse(List permissions, Duration timeout, Context context)" desc: "Sets stored access policies on the queue.\n\n**Code Samples**\n\nSet a read only stored access policy\n\n```java\nQueueAccessPolicy accessPolicy = new QueueAccessPolicy().setPermissions(\"r\")\n .setStartsOn(OffsetDateTime.now(ZoneOffset.UTC))\n .setExpiresOn(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10));\n QueueSignedIdentifier permission = new QueueSignedIdentifier().setId(\"mypolicy\").setAccessPolicy(accessPolicy);\n Response response = client.setAccessPolicyWithResponse(Collections.singletonList(permission),\n Duration.ofSeconds(1), new Context(key1, value1));\n System.out.printf(\"Setting access policies completed with status code %d\", response.getStatusCode());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/set-queue-acl" returns: description: "A response that only contains headers and response status code" type: "<Void>" - uid: "com.azure.storage.queue.QueueClient.setMetadata(java.util.Map)" fullName: "com.azure.storage.queue.QueueClient.setMetadata(Map metadata)" name: "setMetadata(Map metadata)" nameWithType: "QueueClient.setMetadata(Map metadata)" summary: "Sets the metadata of the queue." parameters: - description: "Metadata to set on the queue" name: "metadata" type: "Map<String,String>" syntax: "public void setMetadata(Map metadata)" desc: "Sets the metadata of the queue. Passing in a `null` value for metadata will clear the metadata associated with the queue.\n\n**Code Samples**\n\nSet the queue's metadata to \"queue:metadataMap\"\n\n```java\nclient.setMetadata(Collections.singletonMap(\"queue\", \"metadataMap\"));\n System.out.println(\"Setting metadata completed.\");\n```\n\nClear the queue's metadata\n\n```java\nclient.setMetadata(null);\n System.out.println(\"Clearing metadata completed.\");\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/set-queue-metadata" - uid: "com.azure.storage.queue.QueueClient.setMetadataWithResponse(java.util.Map,java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.setMetadataWithResponse(Map metadata, Duration timeout, Context context)" name: "setMetadataWithResponse(Map metadata, Duration timeout, Context context)" nameWithType: "QueueClient.setMetadataWithResponse(Map metadata, Duration timeout, Context context)" summary: "Sets the metadata of the queue." parameters: - description: "Metadata to set on the queue" name: "metadata" type: "Map<String,String>" - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response setMetadataWithResponse(Map metadata, Duration timeout, Context context)" desc: "Sets the metadata of the queue. Passing in a `null` value for metadata will clear the metadata associated with the queue.\n\n**Code Samples**\n\nSet the queue's metadata to \"queue:metadataMap\"\n\n```java\nclient.setMetadataWithResponse(Collections.singletonMap(\"queue\", \"metadataMap\"),\n Duration.ofSeconds(1), new Context(key1, value1));\n System.out.println(\"Setting metadata completed.\");\n```\n\nClear the queue's metadata\n\n```java\nResponse response = client.setMetadataWithResponse(null, Duration.ofSeconds(1),\n new Context(key1, value1));\n System.out.printf(\"Clearing metadata completed with status code %d\", response.getStatusCode());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/set-queue-metadata" returns: description: "A response that only contains headers and response status code" type: "<Void>" - uid: "com.azure.storage.queue.QueueClient.updateMessage(java.lang.String,java.lang.String,java.lang.String,java.time.Duration)" fullName: "com.azure.storage.queue.QueueClient.updateMessage(String messageId, String popReceipt, String messageText, Duration visibilityTimeout)" name: "updateMessage(String messageId, String popReceipt, String messageText, Duration visibilityTimeout)" nameWithType: "QueueClient.updateMessage(String messageId, String popReceipt, String messageText, Duration visibilityTimeout)" summary: "Updates the specific message in the queue with a new message and resets the visibility timeout." parameters: - description: "Id of the message to update" name: "messageId" type: "String" - description: "Unique identifier that must match for the message to be updated" name: "popReceipt" type: "String" - description: "Updated value for the message" name: "messageText" type: "String" - description: "The timeout period for how long the message is invisible in the queue in seconds. The\n timeout period must be between 1 second and 7 days. The default value is Duration.ZERO." name: "visibilityTimeout" type: "Duration" syntax: "public UpdateMessageResult updateMessage(String messageId, String popReceipt, String messageText, Duration visibilityTimeout)" desc: "Updates the specific message in the queue with a new message and resets the visibility timeout.\n\n**Code Samples**\n\nDequeue the first message and update it to \"Hello again, Azure\" and hide it for 5 seconds\n\n```java\nQueueMessageItem queueMessageItem = client.receiveMessage();\n UpdateMessageResult result = client.updateMessage(queueMessageItem.getMessageId(),\n queueMessageItem.getPopReceipt(), \"newText\", null);\n System.out.println(\"Complete updating the message with the receipt \" + result.getPopReceipt());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/update-message" returns: description: "A that contains the new\n to interact with the message,\n additionally contains the updated metadata about the message." type: "" - uid: "com.azure.storage.queue.QueueClient.updateMessageWithResponse(java.lang.String,java.lang.String,java.lang.String,java.time.Duration,java.time.Duration,com.azure.core.util.Context)" fullName: "com.azure.storage.queue.QueueClient.updateMessageWithResponse(String messageId, String popReceipt, String messageText, Duration visibilityTimeout, Duration timeout, Context context)" name: "updateMessageWithResponse(String messageId, String popReceipt, String messageText, Duration visibilityTimeout, Duration timeout, Context context)" nameWithType: "QueueClient.updateMessageWithResponse(String messageId, String popReceipt, String messageText, Duration visibilityTimeout, Duration timeout, Context context)" summary: "Updates the specific message in the queue with a new message and resets the visibility timeout." parameters: - description: "Id of the message to update" name: "messageId" type: "String" - description: "Unique identifier that must match for the message to be updated" name: "popReceipt" type: "String" - description: "Updated value for the message" name: "messageText" type: "String" - description: "The timeout period for how long the message is invisible in the queue in seconds. The\n timeout period must be between 1 second and 7 days. The default value is Duration.ZERO." name: "visibilityTimeout" type: "Duration" - description: "An optional timeout applied to the operation. If a response is not returned before the timeout\n concludes a will be thrown." name: "timeout" type: "Duration" - description: "Additional context that is passed through the Http pipeline during the service call." name: "context" type: "" syntax: "public Response updateMessageWithResponse(String messageId, String popReceipt, String messageText, Duration visibilityTimeout, Duration timeout, Context context)" desc: "Updates the specific message in the queue with a new message and resets the visibility timeout.\n\n**Code Samples**\n\nDequeue the first message and update it to \"Hello again, Azure\" and hide it for 5 seconds\n\n```java\nQueueMessageItem queueMessageItem = client.receiveMessage();\n Response response = client.updateMessageWithResponse(queueMessageItem.getMessageId(),\n queueMessageItem.getPopReceipt(), \"newText\", null, Duration.ofSeconds(1),\n new Context(key1, value1));\n System.out.println(\"Complete updating the message with status code \" + response.getStatusCode());\n```\n\nFor more information, see the [Azure Docs][].\n\n\n[Azure Docs]: https://docs.microsoft.com/rest/api/storageservices/update-message" returns: description: "A response containing the that contains the new to interact with the message, additionally contains the updated\n metadata about the message." type: "<>" type: "class" desc: "This class provides a client that contains all the operations for interacting with a queue in Azure Storage Queue. Operations allowed by the client are creating and deleting the queue, retrieving and updating metadata and access policies of the queue, and enqueuing, dequeuing, peeking, updating, and deleting messages.\n\n**Instantiating an Synchronous Queue Client**\n\n```java\nQueueClient client = new QueueClientBuilder()\n .connectionString(\"connectionstring\")\n .endpoint(\"endpoint\")\n .buildClient();\n```\n\nView for additional ways to construct the client." metadata: {} package: "com.azure.storage.queue" artifact: com.azure:azure-storage-queue:12.22.1