コード例 #1
0
        private static string GetTrackingId(IDictionary <string, object> requestProperties, IDictionary <string, string> requestHeaders)
        {
            TrackingIdMessageProperty trackingIdMessageProperty;
            string trackingId;

            if (!TrackingIdMessageProperty.TryGet <TrackingIdMessageProperty>(requestProperties, out trackingIdMessageProperty))
            {
                if (!TrackingContext.TryGetHeader(requestHeaders, "TrackingId", out trackingId))
                {
                    if (!requestHeaders.ContainsKey("MessageId"))
                    {
                        Guid guid = Guid.NewGuid();
                        trackingId = TrackingContext.AppendRoleInstanceInformationToTrackingId(guid.ToString());
                        TrackingIdMessageProperty.TryAdd(requestProperties, trackingId);
                    }
                    else
                    {
                        UniqueId uniqueId    = new UniqueId(requestHeaders["MessageId"]);
                        Guid     trackingId1 = TrackingContext.GetTrackingId(uniqueId);
                        trackingId = TrackingContext.AppendRoleInstanceInformationToTrackingId(trackingId1.ToString());
                    }
                }
                TrackingIdMessageProperty.TryAdd(requestProperties, trackingId);
            }
            else
            {
                trackingId = trackingIdMessageProperty.Id;
            }
            return(trackingId);
        }
コード例 #2
0
        internal static TrackingContext GetInstance(Guid guidTrackingId, string overrideSystemTracker)
        {
            string str;

            str = (!string.IsNullOrEmpty(overrideSystemTracker) ? overrideSystemTracker : string.Empty);
            string trackingId = TrackingContext.AppendRoleInstanceInformationToTrackingId(guidTrackingId.ToString());

            return(new TrackingContext(trackingId, str));
        }
コード例 #3
0
        internal static TrackingContext GetInstance(string stringTrackingId, string overrideSystemTracker, bool embedRoleInformation)
        {
            string str;

            str = (!string.IsNullOrEmpty(overrideSystemTracker) ? overrideSystemTracker : string.Empty);
            string trackingId = stringTrackingId;

            if (embedRoleInformation)
            {
                trackingId = TrackingContext.AppendRoleInstanceInformationToTrackingId(stringTrackingId);
            }
            return(new TrackingContext(trackingId, str));
        }
コード例 #4
0
        internal static TrackingContext GetInstance(Message message, string overrideSystemTracker, bool embedRoleInformation, WebOperationContext webOperationContext = null)
        {
            string            str;
            MessageProperties properties = message.Properties;
            MessageHeaders    headers    = message.Headers;
            string            trackingId = TrackingContext.GetTrackingId(properties, headers, webOperationContext);

            str = (!string.IsNullOrEmpty(overrideSystemTracker) ? overrideSystemTracker : TrackingContext.GetSystemTracker(properties, headers));
            string trackingId1 = trackingId;

            if (embedRoleInformation)
            {
                trackingId1 = TrackingContext.AppendRoleInstanceInformationToTrackingId(trackingId);
            }
            return(new TrackingContext(trackingId1, str));
        }
コード例 #5
0
        internal static string GetTrackingId(MessageProperties messageProperties, MessageHeaders messageHeaders, WebOperationContext webOperationContext)
        {
            string id;
            TrackingIdMessageProperty trackingIdMessageProperty;
            TrackingIdHeader          trackingIdHeader;

            if (!TrackingIdMessageProperty.TryGet <TrackingIdMessageProperty>(messageProperties, out trackingIdMessageProperty))
            {
                string str = null;
                if (webOperationContext != null)
                {
                    str = webOperationContext.IncomingRequest.Headers.Get("TrackingId");
                }
                if (TrackingIdHeader.TryRead(messageHeaders, out trackingIdHeader))
                {
                    id = trackingIdHeader.Id;
                }
                else if (messageHeaders.RelatesTo != null)
                {
                    Guid trackingId = TrackingContext.GetTrackingId(messageHeaders.RelatesTo);
                    id = TrackingContext.AppendRoleInstanceInformationToTrackingId(trackingId.ToString());
                }
                else if (messageHeaders.MessageId != null)
                {
                    Guid guid = TrackingContext.GetTrackingId(messageHeaders.MessageId);
                    id = TrackingContext.AppendRoleInstanceInformationToTrackingId(guid.ToString());
                }
                else if (string.IsNullOrEmpty(str))
                {
                    Guid guid1 = Guid.NewGuid();
                    id = TrackingContext.AppendRoleInstanceInformationToTrackingId(guid1.ToString());
                }
                else
                {
                    id = TrackingContext.AppendRoleInstanceInformationToTrackingId(str);
                }
                TrackingIdMessageProperty.TryAdd(messageProperties, id);
            }
            else
            {
                id = trackingIdMessageProperty.Id;
            }
            return(id);
        }