public AmazonSqsHostConfigurator(Uri address)
        {
            var hostAddress = new AmazonSqsHostAddress(address);

            var regionEndpoint = RegionEndpoint.GetBySystemName(hostAddress.Host);

            _settings = new ConfigurationHostSettings
            {
                Scope           = hostAddress.Scope,
                Region          = regionEndpoint,
                AmazonSqsConfig = new AmazonSQSConfig {
                    RegionEndpoint = regionEndpoint
                },
                AmazonSnsConfig = new AmazonSimpleNotificationServiceConfig {
                    RegionEndpoint = regionEndpoint
                }
            };

            if (!string.IsNullOrEmpty(address.UserInfo))
            {
                string[] parts = address.UserInfo.Split(':');
                _accessKey = parts[0];

                if (parts.Length >= 2)
                {
                    _secretKey = parts[1];
                    SetBasicCredentials();
                }
            }
        }
Пример #2
0
        public AmazonSqsHostConfigurator(Uri address)
        {
            if (string.Compare("amazonsqs", address.Scheme, StringComparison.OrdinalIgnoreCase) != 0)
            {
                throw new AmazonSqsTransportConfigurationException($"The address scheme was invalid: {address.Scheme}");
            }

            var regionEndpoint = RegionEndpoint.GetBySystemName(address.Host);

            _settings = new ConfigurationHostSettings
            {
                Region          = regionEndpoint,
                AccessKey       = "",
                SecretKey       = "",
                AmazonSqsConfig = new AmazonSQSConfig {
                    RegionEndpoint = regionEndpoint
                },
                AmazonSnsConfig = new AmazonSimpleNotificationServiceConfig {
                    RegionEndpoint = regionEndpoint
                },
            };

            if (!string.IsNullOrEmpty(address.UserInfo))
            {
                string[] parts = address.UserInfo.Split(':');
                _settings.AccessKey = parts[0];

                if (parts.Length >= 2)
                {
                    _settings.SecretKey = parts[1];
                }
            }
        }