Exemplo n.º 1
0
        internal string GetRequestUrl(string topicName, params string[] parts)
        {
            var configuration = this.EnsureConfiguration();
            var region        = configuration.Topics.Region ?? Aliyun.Configuration.Instance.Name;

            if (configuration.Topics.TryGet(topicName, out var option) && option.Region.HasValue)
            {
                region = option.Region.Value;
            }

            var center = ServiceCenter.GetInstance(region, Aliyun.Configuration.Instance.IsInternal);

            var path = parts == null ? string.Empty : string.Join("/", parts);

            if (string.IsNullOrEmpty(path))
            {
                return(string.Format("http://{0}.{1}/topics/{2}", configuration.Name, center.Path, topicName));
            }
            else
            {
                return(string.Format("http://{0}.{1}/topics/{2}/{3}", configuration.Name, center.Path, topicName, path));
            }
        }
Exemplo n.º 2
0
        public static string GetRequestUrl(string topicName, params string[] parts)
        {
            var options = MessageUtility.GetOptions();
            var region  = options.Topics.Region ?? Aliyun.Options.GeneralOptions.Instance.Name;

            if (options.Topics.TryGet(topicName, out var option) && option.Region.HasValue)
            {
                region = option.Region.Value;
            }

            var center = ServiceCenter.GetInstance(region, Aliyun.Options.GeneralOptions.Instance.IsIntranet);

            var path = parts == null ? string.Empty : string.Join("/", parts);

            if (string.IsNullOrEmpty(path))
            {
                return(string.Format("http://{0}.{1}/topics/{2}", options.Name, center.Path, topicName));
            }
            else
            {
                return(string.Format("http://{0}.{1}/topics/{2}/{3}", options.Name, center.Path, topicName, path));
            }
        }