コード例 #1
0
 public Task ClearMessages(QueueUri queueUri)
 {
     var messagesUri = new QueueMessagesUri(queueUri.Account, queueUri.QueueName.ToString(), null, null);
     var result = _GetHttpClientAdapter(queueUri.Account).Delete(messagesUri);
     return result.ContinueWith(x =>
                                {
                                    if (x.Result.StatusCode != HttpStatusCode.NoContent)
                                        throw new AzureStorageException("ClearMessages", messagesUri,
                                                                        x.Result);
                                });
 }
コード例 #2
0
 private Task<IEnumerable<QueueMessage>> _GetMessages(QueueUri queueUri, int numOfMessages, TimeSpan visibilityTimeout)
 {
     var uri = new QueueMessagesUri(queueUri.Account, queueUri.QueueName.ToString(), numOfMessages, visibilityTimeout);
     var result = _GetHttpClientAdapter(queueUri.Account).Get(uri);
     return result.ContinueWith(x =>
                             {
                                 if (x.Result.StatusCode != HttpStatusCode.OK)
                                     throw new AzureStorageException("GetMessage/Get32Messages", uri, x.Result);
                                 var messages = _queueSerialization.ParseMessages(x.Result);
                                 return messages;
                             });
 }
コード例 #3
0
 public Task<QueueMessage> PeekMessage(QueueUri queueUri)
 {
     var uri = new QueueMessagesUri(queueUri.Account, queueUri.QueueName.ToString(), 1, null, true);
     var result = _GetHttpClientAdapter(queueUri.Account).Get(uri);
     return result.ContinueWith(x =>
                             {
                                 if (x.Result.StatusCode != HttpStatusCode.OK)
                                     throw new AzureStorageException("PeekMessage", uri, x.Result);
                                 var messages = _queueSerialization.ParseMessages(x.Result);
                                 return messages.FirstOrDefault();
                             });
 }