Пример #1
0
        public AzureESBQueue(Uri uri, IAzureESBConfiguration configuration)
        {
            Guard.AgainstNull(uri, "uri");
            Guard.AgainstNull(configuration, "configuration");

            _configuration       = configuration;
            _operationRetryCount = _configuration.OperationRetryCount;

            _parser = new AzureESBUriParser(uri, configuration);

            Uri = uri;

            _factory = MessagingFactory.CreateFromConnectionString(_parser.ConnectionString);
        }
Пример #2
0
        public AzureESBUriParser(Uri uri, IAzureESBConfiguration config)
        {
            Guard.AgainstNull(uri, "uri");
            Guard.AgainstNull(config, "config");

            if (!uri.Scheme.Equals(SCHEME, StringComparison.InvariantCultureIgnoreCase))
            {
                throw new InvalidSchemeException(SCHEME, uri.ToString());
            }

            StringBuilder connectionString = new StringBuilder(@"Endpoint=sb://");

            connectionString.Append(uri.Host + ";");
            connectionString.Append("SharedAccessKeyName=" + config.SharedAccessKeyName + ";");
            connectionString.Append(uri.LocalPath.Substring(uri.LocalPath.IndexOf("SharedAccessKey")));
            if (config.TransportType != string.Empty)
            {
                connectionString.Append(";TransportType=" + config.TransportType);
            }

            ConnectionString = connectionString.ToString();

            Queue = uri.PathAndQuery.Substring(1, uri.PathAndQuery.IndexOf(';') - 1);
        }