public async Task ProcessMessageAsync(ICommand command)
        {
            var document = await ProcessAsync(command);

            if (document != null)
            {
                try
                {
                    await UpdateDocument(document);
                }
                catch (MongoException ex)
                {
                    _logger.LogError("BaseProcessor", ex, "qMessage processing failed due to mongoDb exception");

                    try
                    {
                        await _retryHelper.Do(UpdateDocument, document, new TimeSpan(0, 0, 10), 10);
                    }
                    catch (Exception e)
                    {
                        // throwing the exception pushes the message in to error queue
                        throw e;
                    }
                }
            }
        }
Пример #2
0
        protected async Task Execute(ICommand qMessage)
        {
            try
            {
                await OnMessageReceived(qMessage);
            }
            catch (HttpRequestException ex)
            {
                _logger.LogError("ScopedReceiver", ex, "qMessage processing failed in the first attempt");

                try
                {
                    await _retryHelper.Do(OnMessageReceived, qMessage, new TimeSpan(0, 0, 10));
                }
                catch (Exception e)
                {
                    // throwing the exception pushes the message in to error queue
                    throw e;
                }
            }
        }