Beispiel #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);
        }
Beispiel #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));
        }
Beispiel #3
0
        internal static TrackingContext GetInstanceFromKey(string key)
        {
            Guid guid;

            if (!TrackingContext.ComponentTrackingGuids.TryGetValue(key, out guid))
            {
                guid = Guid.NewGuid();
            }
            return(TrackingContext.GetInstance(guid, null));
        }
Beispiel #4
0
        internal static TrackingContext GetInstanceFromKey(string key, string overrideSystemTracker)
        {
            Guid   guid;
            string str;

            if (!TrackingContext.ComponentTrackingGuids.TryGetValue(key, out guid))
            {
                guid = Guid.NewGuid();
            }
            str = (!string.IsNullOrEmpty(overrideSystemTracker) ? overrideSystemTracker : string.Empty);
            return(TrackingContext.GetInstance(guid, str));
        }
Beispiel #5
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));
        }
Beispiel #6
0
        private static string GetSystemTracker(IDictionary <string, object> messageProperties, IDictionary <string, string> messageHeaders)
        {
            string tracker;
            SystemTrackerMessageProperty systemTrackerMessageProperty;
            string str;

            if (!SystemTrackerMessageProperty.TryGet <SystemTrackerMessageProperty>(messageProperties, out systemTrackerMessageProperty))
            {
                tracker = (!TrackingContext.TryGetHeader(messageHeaders, "SystemTracker", out str) ? string.Empty : str);
            }
            else
            {
                tracker = systemTrackerMessageProperty.Tracker;
            }
            return(tracker);
        }
Beispiel #7
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));
        }
Beispiel #8
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);
        }
 public NotificationRequestAsyncResult(NotificationHubManager manager, bool needRequestStream, AsyncCallback callback, object state) : base(ConnectConstants.ConnectionInitiateTimeout, callback, state)
 {
     this.TrackingContext   = Microsoft.ServiceBus.Tracing.TrackingContext.GetInstance(Guid.NewGuid(), manager.notificationHubPath);
     this.Manager           = manager;
     this.needRequestStream = needRequestStream;
 }
Beispiel #10
0
 internal static TrackingContext GetInstance(Message message, bool embedRoleInformation)
 {
     return(TrackingContext.GetInstance(message, string.Empty, embedRoleInformation, null));
 }
Beispiel #11
0
 internal static TrackingContext GetInstance(Message message, WebOperationContext webOperationContext, bool embedRoleInformation)
 {
     return(TrackingContext.GetInstance(message, string.Empty, embedRoleInformation, webOperationContext));
 }
Beispiel #12
0
        internal static TrackingContext GetInstance(IDictionary <string, object> messageProperties, IDictionary <string, string> messageHeaders)
        {
            string trackingId = TrackingContext.GetTrackingId(messageProperties, messageHeaders);

            return(new TrackingContext(trackingId, TrackingContext.GetSystemTracker(messageProperties, messageHeaders)));
        }
Beispiel #13
0
 internal static TrackingContext GetInstance(string stringTrackingId, bool embedRoleInformation)
 {
     return(TrackingContext.GetInstance(stringTrackingId, null, embedRoleInformation));
 }
Beispiel #14
0
 internal static TrackingContext GetInstance(Guid guidTrackingId)
 {
     return(TrackingContext.GetInstance(guidTrackingId, null));
 }