Exemple #1
0
        public async Task <BatchDeleteQueueMessagesCommandResponse> Handle(BatchDeleteQueueMessagesCommand query)
        {
            foreach (var batch in query.Ids.Batch(_batchSize))
            {
                using var ts = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);
                try
                {
                    await _cosmosDbContext.DeleteQueueMessagesAsync(query.Ids);

                    ts.Complete();

                    await _auditService.WriteAudit(new MessageQueueDeleteAuditMessage(query.Ids));
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, "Failed to delete messages");
                }
            }

            return(new BatchDeleteQueueMessagesCommandResponse());
        }
Exemple #2
0
        public async Task <DeleteQueueMessagesCommandResponse> Handle(DeleteQueueMessagesCommand query)
        {
            await _cosmosDbContext.DeleteQueueMessagesAsync(query.Ids);

            return(new DeleteQueueMessagesCommandResponse());
        }