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); }); }
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; }); }
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(); }); }