public static string ToStomp(ActiveMQDestination destination) { if (destination == null) { return null; } else { switch (destination.DestinationType) { case DestinationType.Topic: return "/topic/" + destination.PhysicalName; case DestinationType.TemporaryTopic: return "/temp-topic/" + destination.PhysicalName; case DestinationType.TemporaryQueue: return "/temp-queue/" + destination.PhysicalName; default: return "/queue/" + destination.PhysicalName; } } }
protected void DestroyTemporaryDestination(ActiveMQDestination tempDestination) { DestinationInfo command = new DestinationInfo(); command.ConnectionId = connection.ConnectionId; command.OperationType = 1; // 1 is remove command.Destination = tempDestination; connection.SyncRequest(command); }
protected void CreateTemporaryDestination(ActiveMQDestination tempDestination) { DestinationInfo command = new DestinationInfo(); command.ConnectionId = connection.ConnectionId; command.OperationType = 0; // 0 is add command.Destination = tempDestination; connection.SyncRequest(command); }
/** * Lets sort by name first then lets sort topics greater than queues * * @param that another destination to compare against * @return 1 if this is less than o else 0 if they are equal or -1 if this is less than o */ public int CompareTo(ActiveMQDestination 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; }
/** * From a temporary destination find the clientId of the Connection that created it * * @param destination * @return the clientId or null if not a temporary destination */ public static String GetClientId(ActiveMQDestination 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; }
/** * A helper method to return a descriptive string for the topic or queue * @param destination * * @return a descriptive string for this queue or topic */ public static String Inspect(ActiveMQDestination destination) { if (destination is ITopic) { return "Topic(" + destination.ToString() + ")"; } else { return "Queue(" + destination.ToString() + ")"; } }
public abstract bool matches(ActiveMQDestination destination);