Ejemplo n.º 1
0
        public async Task <CommandQueueServiceResponse> TryDeleteMessageAsync()
        {
            try
            {
                await _queue.CreateIfNotExistsAsync();

                var cloudQueueMessage = await _queue.GetMessageAsync();

                await _queue.DeleteMessageAsync(cloudQueueMessage);

                return(CommandQueueServiceResponse.Success(cloudQueueMessage.AsString));
            }
            catch (Exception exception)
            {
                return(CommandQueueServiceResponse.Failure(exception.Message));
            }
        }
Ejemplo n.º 2
0
        public async Task <CommandQueueServiceResponse> TryAddMessageAsync(string message)
        {
            try
            {
                await _queue.CreateIfNotExistsAsync();

                var cloudQueueMessage = new CloudQueueMessage(message);

                await _queue.AddMessageAsync(cloudQueueMessage);

                return(CommandQueueServiceResponse.Success(message));
            }
            catch (Exception exception)
            {
                return(CommandQueueServiceResponse.Failure(exception.Message));
            }
        }