Exemplo n.º 1
0
        /// <inheritdoc />
        public virtual async Task HandleMessageProcessingFailure(MessageHandlingContext context, Exception exception)
        {
            var eventArgs = context.Message;

            if (context.AutoAckEnabled)
            {
                context.AcknowledgeMessage();
            }

            _loggingService.LogError(exception, $"An error occurred while processing received message with the delivery tag {eventArgs.DeliveryTag}.");
            await HandleFailedMessageProcessing(eventArgs).ConfigureAwait(false);
        }
Exemplo n.º 2
0
        /// <inheritdoc />
        public async Task HandleMessageReceivingEvent(MessageHandlingContext context)
        {
            var eventArgs = context.Message;

            _loggingService.LogInformation($"A new message received with deliveryTag {eventArgs.DeliveryTag}.");
            var matchingRoutes = GetMatchingRoutePatterns(eventArgs.Exchange, eventArgs.RoutingKey);

            await ProcessMessageEvent(context, matchingRoutes).ConfigureAwait(false);

            if (context.AutoAckEnabled)
            {
                context.AcknowledgeMessage();
            }
            _loggingService.LogInformation($"Message processing finished successfully. Acknowledge has been sent with deliveryTag {eventArgs.DeliveryTag}.");
        }