Пример #1
0
        static void SetUpEventHandler(BaseConfigurer configurer, string correlationIdPropertyKey)
        {
            configurer.Backbone.ConfigureEvents(e =>
            {
                e.BeforeTransportMessage +=
                    (bus, message) =>
                    {
                        var correlationid = message.Headers.ContainsKey(Headers.CorrelationId)
                                                ? message.Headers[Headers.CorrelationId]
                                                : "";

                        MappedDiagnosticsContext.Set(correlationIdPropertyKey, correlationid.ToString());
                    };
            });
        }
        static void SetUpEventHandler(BaseConfigurer configurer, string correlationIdPropertyKey)
        {
            configurer.Backbone.ConfigureEvents(e =>
                {
                    e.BeforeTransportMessage +=
                        (bus, message) =>
                            {
                                var correlationid = message.Headers.ContainsKey(Headers.CorrelationId)
                                                        ? message.Headers[Headers.CorrelationId]
                                                        : null;

                                ThreadContext.Properties[correlationIdPropertyKey] = correlationid;
                            };
                });
        }
        static void SetUpEventHandler(BaseConfigurer configurer, string overriddenCorrelationIdPropertyKey = null)
        {
            if (!string.IsNullOrWhiteSpace(overriddenCorrelationIdPropertyKey))
            {
                correlationIdPropertyKey = overriddenCorrelationIdPropertyKey;
            }

            configurer.Backbone.ConfigureEvents(e =>
                {
                    e.BeforeTransportMessage +=
                        (bus, message) =>
                            {
                                var correlationid = message.Headers.ContainsKey(Headers.CorrelationId)
                                                        ? message.Headers[Headers.CorrelationId]
                                                        : null;

                                ThreadContext.Properties[correlationIdPropertyKey] = correlationid;
                            };
                });
        }
Пример #4
0
 static void SetUpEventHandler(BaseConfigurer configurer, IDictionary<string, string> headerKeyToLoggerPropertyMappings)
 {
     configurer.Backbone.ConfigureEvents(e =>
         {
             e.MessageContextEstablished += 
                 (bus, ctx) => 
                     {
                         foreach (var key in ctx.Headers.Keys.Intersect(headerKeyToLoggerPropertyMappings.Keys))
                         {
                             PushHeaderProperty(key, ctx, headerKeyToLoggerPropertyMappings[key]);
                         }
                     };
         });
 }