/// <summary> /// Lets sort by name first then lets sort topics greater than queues /// </summary> /// <param name="that">another destination to compare against</param> /// <returns>1 if this is less than o else 0 if they are equal or -1 if this is less than o</returns> public int CompareTo(Destination that) { int answer = 0; if(physicalName != that.physicalName) { if(physicalName == null) { return -1; } else if(that.physicalName == null) { return 1; } answer = physicalName.CompareTo(that.physicalName); } if(answer == 0) { if(IsTopic) { if(that.IsQueue) { return 1; } } else { if(that.IsTopic) { return -1; } } } return answer; }
/// <summary> /// From a temporary destination find the clientId of the Connection that created it /// </summary> /// <param name="destination"></param> /// <returns>the clientId or null if not a temporary destination</returns> public static String GetClientId(Destination destination) { String answer = null; if(destination != null && destination.IsTemporary) { String name = destination.PhysicalName; int start = name.IndexOf(TEMP_PREFIX); if(start >= 0) { start += TEMP_PREFIX.Length; int stop = name.LastIndexOf(TEMP_POSTFIX); if(stop > start && stop < name.Length) { answer = name.Substring(start, stop); } } } return answer; }