public static IDestination GetDestination()

in src/nms-api/Util/SessionUtils.cs [65:128]


        public static IDestination GetDestination(ISession session, string destinationName, DestinationType defaultType)
        {
            IDestination destination = null;
            DestinationType destinationType = defaultType;

            if (null != destinationName)
            {
                if (destinationName.Length > QueuePrefix.Length
                    && 0 == String.Compare(destinationName.Substring(0, QueuePrefix.Length), QueuePrefix, false))
                {
                    destinationType = DestinationType.Queue;
                    destinationName = destinationName.Substring(QueuePrefix.Length);
                }
                else if (destinationName.Length > TopicPrefix.Length
                         && 0 == String.Compare(destinationName.Substring(0, TopicPrefix.Length), TopicPrefix, false))
                {
                    destinationType = DestinationType.Topic;
                    destinationName = destinationName.Substring(TopicPrefix.Length);
                }
                else if (destinationName.Length > TempQueuePrefix.Length
                         && 0 == String.Compare(destinationName.Substring(0, TempQueuePrefix.Length), TempQueuePrefix,
                             false))
                {
                    destinationType = DestinationType.TemporaryQueue;
                    destinationName = destinationName.Substring(TempQueuePrefix.Length);
                }
                else if (destinationName.Length > TempTopicPrefix.Length
                         && 0 == String.Compare(destinationName.Substring(0, TempTopicPrefix.Length), TempTopicPrefix,
                             false))
                {
                    destinationType = DestinationType.TemporaryTopic;
                    destinationName = destinationName.Substring(TempTopicPrefix.Length);
                }
            }

            switch (destinationType)
            {
                case DestinationType.Queue:
                    if (null != destinationName)
                    {
                        destination = session.GetQueue(destinationName);
                    }

                    break;

                case DestinationType.Topic:
                    if (null != destinationName)
                    {
                        destination = session.GetTopic(destinationName);
                    }

                    break;

                case DestinationType.TemporaryQueue:
                    destination = session.CreateTemporaryQueue();
                    break;

                case DestinationType.TemporaryTopic:
                    destination = session.CreateTemporaryTopic();
                    break;
            }

            return destination;
        }