/// <inheritdoc cref="IConsumerBehavior.HandleAsync" /> public async Task HandleAsync( ConsumerPipelineContext context, ConsumerBehaviorHandler next) { Check.NotNull(context, nameof(context)); Check.NotNull(next, nameof(next)); try { await next(context).ConfigureAwait(false); } catch (Exception ex) { _logger.LogCriticalWithMessageInfo( IntegrationEventIds.ConsumerFatalError, ex, "Fatal error occurred processing the consumed message. The consumer will be stopped.", context); throw; } }
public void LogCriticalWithMessageInfo_SingleInboundMessage_CriticalLogged() { _integrationLogger.LogCriticalWithMessageInfo( new EventId(42, "test"), "Log message", _singleInboundMessageContext); const string expectedMessage = "Log message | " + "endpointName: TestActual, " + "failedAttempts: 1, " + "messageType: Something.Xy, " + "messageId: 1234, " + "offset-in: 9"; _logger.Received(LogLevel.Critical, null, expectedMessage); }