Begins an asynchronous operation to return a result segment containing a collection of queues whose names begin with the specified prefix. Namespace: Microsoft.WindowsAzure.StorageClient
Assembly: Microsoft.WindowsAzure.StorageClient (in Microsoft.WindowsAzure.StorageClient.dll)
Usage
Visual Basic |
---|
Dim instance As CloudQueueClient Dim prefix As String Dim callback As AsyncCallback Dim state As Object Dim returnValue As IAsyncResult returnValue = instance.BeginListQueuesSegmented(prefix, callback, state) |
Syntax
Visual Basic |
---|
Public Function BeginListQueuesSegmented ( _ prefix As String, _ callback As AsyncCallback, _ state As Object _ ) As IAsyncResult |
C# |
---|
public IAsyncResult BeginListQueuesSegmented ( string prefix, AsyncCallback callback, Object state ) |
C++ |
---|
public: IAsyncResult^ BeginListQueuesSegmented ( String^ prefix, AsyncCallback^ callback, Object^ state ) |
J# |
---|
JScript |
---|
Parameters
- prefix
Type: System.String
The queue name prefix.
- callback
Type: System.AsyncCallback
The callback delegate that will receive notification when the asynchronous operation completes.
- state
Type: System.Object
A user-defined object that will be passed to the callback delegate.
Return Value
Type: System.IAsyncResultAn IAsyncResult that references the asynchronous operation.Example
The following code example lists queues in result segments asynchronously.
Copy Code | |
---|---|
static void ListQueuesInSegmentsAsync(Uri queueEndpoint, string accountName, string accountKey) { //Create service client for credentialed access to the Queue service. CloudQueueClient queueClient = new CloudQueueClient(queueEndpoint, new StorageCredentialsAccountAndKey(accountName, accountKey)); //Return a page of 10 queues beginning with the specified prefix. queueClient.BeginListQueuesSegmented("my", QueueListingDetails.Metadata, 10, null, ListQueuesInSegmentsAsyncCallback, queueClient); } static void ListQueuesInSegmentsAsyncCallback(IAsyncResult result) { CloudQueueClient queueClient = (CloudQueueClient)result.AsyncState; ResultSegment<CloudQueue> resultSegment = queueClient.EndListQueuesSegmented(result); WriteQueuesInResultSegment(resultSegment); //Check that the page is complete. while (resultSegment.HasMoreResults) { resultSegment.BeginGetNext(GetNextCallback, resultSegment); } } static void GetNextCallback(IAsyncResult result) { ResultSegment<CloudQueue> resultSegment = (ResultSegment<CloudQueue>)result.AsyncState; resultSegment = resultSegment.EndGetNext(result); WriteQueuesInResultSegment(resultSegment); } static void WriteQueuesInResultSegment(ResultSegment<CloudQueue> resultSegment) { foreach (CloudQueue queue in resultSegment.Results) { Console.WriteLine(queue.Name); } } |
Remarks
The BeginListQueuesSegmented method begins an operation to list queues in pages. To specify the page size to return, pass in a non-zero value for the maxResults parameter. Passing in zero for the maxResults parameter returns either the maximum number of results available, or the per-operation limit of 5000 results.
If you have specified a page size, you can check the HasMoreResults property to check whether the page is complete. For example, if you have specified a page size of 10,000, a value which exceeds the per-operation limit, HasMoreResults will return true, indicating that the page is not complete. Note that if you have not specified a page size, HasMoreResults will always be false.
If you have not specified a page size, or the value of maxResults is zero, then check the value of the ContinuationToken property to determine whether there are more results to return. The continuation token is non-null as long as there are more results to return from the service.
Call the GetNext method to return the next segment of results from the service.