public void OnEmptyMessageReceived(IInboundEnvelope envelope)
 {
     if (envelope.Message == null)
     {
         _logger.LogInformation("Empty message received!");
     }
 }
Exemplo n.º 2
0
 public void OnInbound(IInboundEnvelope envelope)
 {
     lock (_inboundEnvelopes)
     {
         _inboundEnvelopes.Add(envelope);
     }
 }
        public Task OnMessageReceived(IInboundEnvelope <WeatherForecast> message)
        {
            // ...your message handling loging...
            using (_logger.BeginScope($"Consuming message {message.Message.Summary}"))
            {
                _logger.LogInformation("completed");
            }

            return(Task.CompletedTask);
        }
Exemplo n.º 4
0
        public void CanHandle_WithApplyWhen_ExpectedResultReturned(
            IInboundEnvelope envelope,
            Exception exception,
            bool mustApply)
        {
            var policy = new TestErrorPolicy()
                         .ApplyWhen(
                (msg, ex) =>
                msg.Headers.GetValue <int>(DefaultMessageHeaders.FailedAttempts) <= 5 && ex.Message != "no")
                         .Build(Substitute.For <IServiceProvider>());

            var canHandle = policy.CanHandle(
                ConsumerPipelineContextHelper.CreateSubstitute(envelope),
                exception);

            canHandle.Should().Be(mustApply);
        }
 private void OnMessageReceived(IInboundEnvelope <IMessage> envelope) => ReceivedEnvelopes.Add(envelope);
Exemplo n.º 6
0
 private void OnInbound(IInboundEnvelope envelope) => _integrationSpy.AddInboundEnvelope(envelope);