public LoggingEventHandlerDecorator(IEventHandler <TEvent> handler, ICorrelationIdFactory correlationIdFactory,
                                     ILogger <IEventHandler <TEvent> > logger)
 {
     _handler = handler;
     _correlationIdFactory = correlationIdFactory;
     _logger = logger;
 }
Exemple #2
0
        public CorrelateOutgoingMessageStep(ICorrelationContextAccessor correlationContextAccessor, ICorrelationIdFactory correlationIdFactory, IRebusLoggerFactory rebusLoggerFactory)
        {
            _correlationContextAccessor = correlationContextAccessor ?? throw new ArgumentNullException(nameof(correlationContextAccessor));
            _correlationIdFactory       = correlationIdFactory ?? throw new ArgumentNullException(nameof(correlationIdFactory));

            _logger = (rebusLoggerFactory ?? new NullLoggerFactory()).GetLogger <CorrelateOutgoingMessageStep>();
        }
 public LoggingCommandHandlerDecorator(ICommandHandler <TCommand> handler,
                                       ICorrelationIdFactory correlationIdFactory, ILogger <ICommandHandler <TCommand> > logger)
 {
     _handler = handler;
     _correlationIdFactory = correlationIdFactory;
     _logger = logger;
 }
Exemple #4
0
 public TracingCommandHandlerDecorator(ICommandHandler <TCommand> handler, ITracer tracer,
                                       ICorrelationIdFactory correlationIdFactory)
 {
     _handler = handler;
     _tracer  = tracer;
     _correlationIdFactory = correlationIdFactory;
 }
 public CorrelationManager(
     ICorrelationContextFactory correlationContextFactory,
     ICorrelationIdFactory correlationIdFactory,
     ILogger <CorrelationManager> logger,
     DiagnosticListener diagnosticListener
     ) : this(correlationContextFactory, correlationIdFactory, logger)
 {
     _diagnosticListener = diagnosticListener ?? throw new ArgumentNullException(nameof(diagnosticListener));
 }
 public CorrelationManager
 (
     ICorrelationContextFactory correlationContextFactory,
     ICorrelationIdFactory correlationIdFactory,
     ILogger <CorrelationManager> logger
 )
 {
     _correlationContextFactory = correlationContextFactory ?? throw new ArgumentNullException(nameof(correlationContextFactory));
     _correlationIdFactory      = correlationIdFactory ?? throw new ArgumentNullException(nameof(correlationIdFactory));
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Exemple #7
0
        public void When_creating_instance_without_correlationIdFactory_it_should_throw()
        {
            ICorrelationIdFactory correlationIdFactory = null;
            // ReSharper disable once ExpressionIsAlwaysNull
            // ReSharper disable once ObjectCreationAsStatement
            Action act = () => new CorrelateOutgoingMessageStep(_correlationContextAccessor, correlationIdFactory, new NullLoggerFactory());

            // Assert
            act.Should()
            .Throw <ArgumentNullException>()
            .Where(exception => exception.ParamName == nameof(correlationIdFactory));
        }
 public MessageBroker(IBusPublisher busPublisher, IMessageOutbox outbox,
                      ICorrelationContextAccessor contextAccessor, IHttpContextAccessor httpContextAccessor,
                      IMessagePropertiesAccessor messagePropertiesAccessor, ICorrelationIdFactory correlationIdFactory,
                      RabbitMqOptions options, ILogger <IMessageBroker> logger)
 {
     _busPublisher              = busPublisher;
     _outbox                    = outbox;
     _contextAccessor           = contextAccessor;
     _httpContextAccessor       = httpContextAccessor;
     _messagePropertiesAccessor = messagePropertiesAccessor;
     _correlationIdFactory      = correlationIdFactory;
     _logger                    = logger;
     _spanContextHeader         = string.IsNullOrWhiteSpace(options.SpanContextHeader)
         ? DefaultSpanContextHeader
         : options.SpanContextHeader;
 }
Exemple #9
0
        public MBHttpClient(HttpClient client, HttpClientOptions options,
                            ICorrelationContextFactory correlationContextFactory, ICorrelationIdFactory correlationIdFactory)
        {
            _client  = client;
            _options = options;
            if (!string.IsNullOrWhiteSpace(_options.CorrelationContextHeader))
            {
                var correlationContext = correlationContextFactory.Create();
                _client.DefaultRequestHeaders.TryAddWithoutValidation(_options.CorrelationContextHeader,
                                                                      correlationContext);
            }

            if (!string.IsNullOrWhiteSpace(_options.CorrelationIdHeader))
            {
                var correlationId = correlationIdFactory.Create();
                _client.DefaultRequestHeaders.TryAddWithoutValidation(_options.CorrelationIdHeader,
                                                                      correlationId);
            }
        }
Exemple #10
0
 public FabioHttpClient(HttpClient client, HttpClientOptions options, IHttpClientSerializer serializer,
                        ICorrelationContextFactory correlationContextFactory, ICorrelationIdFactory correlationIdFactory)
     : base(client, options, serializer, correlationContextFactory, correlationIdFactory)
 {
 }
Exemple #11
0
 public LoggingCommandHandlerDecorator(ICommandHandler <TCommand> handler,
                                       ICorrelationIdFactory correlationIdFactory)
 {
     _handler = handler;
     _correlationIdFactory = correlationIdFactory;
 }
 public LogContextMiddleware(ICorrelationIdFactory correlationIdFactory)
 {
     _correlationIdFactory = correlationIdFactory;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GenerateMessageHeaders" /> class.
 /// </summary>
 /// <param name="correlationIdFactory">The correlation identifier factory.</param>
 public GenerateMessageHeaders(ICorrelationIdFactory correlationIdFactory)
 {
     Guard.NotNull(() => correlationIdFactory, correlationIdFactory);
     _correlationIdFactory = correlationIdFactory;
 }
Exemple #14
0
 public ConsulHttpClient(HttpClient client, HttpClientOptions options,
                         ICorrelationContextFactory correlationContextFactory, ICorrelationIdFactory correlationIdFactory)
     : base(client, options, correlationContextFactory, correlationIdFactory)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GenerateMessageHeaders" /> class.
 /// </summary>
 /// <param name="correlationIdFactory">The correlation identifier factory.</param>
 public GenerateMessageHeaders(ICorrelationIdFactory correlationIdFactory)
 {
     Guard.NotNull(() => correlationIdFactory, correlationIdFactory);
     _correlationIdFactory = correlationIdFactory;
 }
 public LoggingEventHandlerDecorator(IEventHandler <TEvent> handler, ICorrelationIdFactory correlationIdFactory)
 {
     _handler = handler;
     _correlationIdFactory = correlationIdFactory;
 }