QueueServiceClient Class

Definition

This class provides a client that contains all the operations for interacting with a queue account in Azure Storage. Operations allowed by the client are creating, listing, and deleting queues, retrieving and updating properties of the account, and retrieving statistics of the account.

Instantiating an Synchronous Queue Service Client

{@codesnippet com.azure.storage.queue.queueServiceClient.instantiation}

View QueueServiceClientBuilder for additional ways to construct the client.

public final class QueueServiceClient
Inheritance
java.lang.Object
QueueServiceClient

Inherited Members

java.lang.Object.clone() java.lang.Object.equals(java.lang.Object) java.lang.Object.finalize() java.lang.Object.getClass() java.lang.Object.hashCode() java.lang.Object.notify() java.lang.Object.notifyAll() java.lang.Object.toString() java.lang.Object.wait() java.lang.Object.wait(long) java.lang.Object.wait(long,int)

Methods

createQueue(String queueName)

Creates a queue in the storage account with the specified name and returns a QueueClient to interact with it.

Code Samples

Create the queue "test"

{@codesnippet com.azure.storage.queue.queueServiceClient.createQueue#string}

createQueueWithResponse(String queueName, Map<String,String> metadata, Duration timeout, Context context)

Creates a queue in the storage account with the specified name and metadata and returns a QueueClient to interact with it.

Code Samples

Create the queue "test" with metadata "queue:metadata"

{@codesnippet com.azure.storage.queue.queueServiceClient.createQueueWithResponse#string-map-duration-context}

deleteQueue(String queueName)

Deletes a queue in the storage account

Code Samples

Delete the queue "test"

{@codesnippet com.azure.storage.queue.queueServiceClient.deleteQueue#string}

deleteQueueWithResponse(String queueName, Duration timeout, Context context)

Deletes a queue in the storage account

Code Samples

Delete the queue "test"

{@codesnippet com.azure.storage.queue.queueServiceClient.deleteQueueWithResponse#string-duration-context}

generateAccountSas(AccountSasSignatureValues accountSasSignatureValues)

Generates an account SAS for the Azure Storage account using the specified AccountSasSignatureValues.

Note : The client must be authenticated via StorageSharedKeyCredential

See AccountSasSignatureValues for more information on how to construct an account SAS.

Generating an account SAS

The snippet below generates an AccountSasSignatureValues object that lasts for two days and gives the user read and list access to queue and file shares.

{@codesnippet com.azure.storage.queue.QueueServiceClient.generateAccountSas#AccountSasSignatureValues}

generateAccountSas(AccountSasSignatureValues accountSasSignatureValues, Context context)

Generates an account SAS for the Azure Storage account using the specified AccountSasSignatureValues.

Note : The client must be authenticated via StorageSharedKeyCredential

See AccountSasSignatureValues for more information on how to construct an account SAS.

Generating an account SAS

The snippet below generates an AccountSasSignatureValues object that lasts for two days and gives the user read and list access to queue and file shares.

{@codesnippet com.azure.storage.queue.QueueServiceClient.generateAccountSas#AccountSasSignatureValues-Context}

getAccountName()

Get associated account name.

getHttpPipeline()

Gets the HttpPipeline powering this client.

getMessageEncoding()

Gets the message encoding the client is using.

getProperties()

Retrieves the properties of the storage account's Queue service. The properties range from storage analytics and metric to CORS (Cross-Origin Resource Sharing).

Code Samples

Retrieve Queue service properties

{@codesnippet com.azure.storage.queue.queueServiceClient.getProperties}

For more information, see the Azure Docs.

getPropertiesWithResponse(Duration timeout, Context context)

Retrieves the properties of the storage account's Queue service. The properties range from storage analytics and metric to CORS (Cross-Origin Resource Sharing).

Code Samples

Retrieve Queue service properties

{@codesnippet com.azure.storage.queue.queueServiceClient.getPropertiesWithResponse#duration-context}

For more information, see the Azure Docs.

getQueueClient(String queueName)

Constructs a QueueClient that interacts with the specified queue. This will not create the queue in the storage account if it doesn't exist.

getQueueServiceUrl()
getServiceVersion()

Gets the service version the client is using.

getStatistics()

Retrieves the geo replication information about the Queue service.

Code Samples

Retrieve the geo replication information

{@codesnippet com.azure.storage.queue.queueServiceClient.getStatistics}

For more information, see the Azure Docs.

getStatisticsWithResponse(Duration timeout, Context context)

Retrieves the geo replication information about the Queue service.

Code Samples

Retrieve the geo replication information

{@codesnippet com.azure.storage.queue.queueServiceClient.getStatisticsWithResponse#duration-context}

For more information, see the Azure Docs.

listQueues()

Lists all queues in the storage account without their metadata.

Code Samples

List all queues in the account

{@codesnippet com.azure.storage.queue.queueServiceClient.listQueues}

For more information, see the Azure Docs.

listQueues(QueuesSegmentOptions options, Duration timeout, Context context)

Lists the queues in the storage account that pass the filter. Pass true to setIncludeMetadata(boolean includeMetadata) to have metadata returned for the queues.

Code Samples

List all queues that begin with "azure"

{@codesnippet com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions-duration-context}

For more information, see the Azure Docs.

setProperties(QueueServiceProperties properties)

Sets the properties for the storage account's Queue service. The properties range from storage analytics and metric to CORS (Cross-Origin Resource Sharing). To maintain the CORS in the Queue service pass a null value for getCors(). To disable all CORS in the Queue service pass an empty list for getCors().

Code Sample

Clear CORS in the Queue service

{@codesnippet com.azure.storage.queue.queueServiceClient.setProperties#QueueServiceProperties}

Enable Minute and Hour Metrics

{@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#QueueServiceProperties}

For more information, see the Azure Docs.

setPropertiesWithResponse(QueueServiceProperties properties, Duration timeout, Context context)

Sets the properties for the storage account's Queue service. The properties range from storage analytics and metric to CORS (Cross-Origin Resource Sharing). To maintain the CORS in the Queue service pass a null value for getCors(). To disable all CORS in the Queue service pass an empty list for getCors().

Code Sample

Clear CORS in the Queue service

{@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesWithResponse#QueueServiceProperties-duration-context}

Enable Minute and Hour Metrics

{@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesWithResponseEnableMetrics#QueueServiceProperties-duration-context}

For more information, see the Azure Docs.

Applies to