/// <summary>
        ///   Initializes a new instance of the <see cref="ServiceBusConnection"/> class.
        /// </summary>
        ///
        /// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace to connect to.  This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
        /// <param name="credential">The Azure managed identity credential to use for authorization.  Access controls may be specified by the Service Bus namespace or the requested Service Bus entity, depending on Azure configuration.</param>
        /// <param name="options">A set of options to apply when configuring the connection.</param>
        ///
        internal ServiceBusConnection(
            string fullyQualifiedNamespace,
            TokenCredential credential,
            ServiceBusClientOptions options)
        {
            Argument.AssertWellFormedServiceBusNamespace(fullyQualifiedNamespace, nameof(fullyQualifiedNamespace));
            Argument.AssertNotNull(credential, nameof(credential));

            options = options?.Clone() ?? new ServiceBusClientOptions();
            ValidateConnectionOptions(options);
            switch (credential)
            {
            case SharedAccessSignatureCredential _:
                break;

            case ServiceBusSharedKeyCredential sharedKeyCredential:
                credential = sharedKeyCredential.AsSharedAccessSignatureCredential(BuildAudienceResource(options.TransportType, fullyQualifiedNamespace, EntityPath));
                break;
            }

            var tokenCredential = new ServiceBusTokenCredential(credential, BuildAudienceResource(options.TransportType, fullyQualifiedNamespace, EntityPath));

            FullyQualifiedNamespace = fullyQualifiedNamespace;
            TransportType           = options.TransportType;
            Options      = options;
            RetryOptions = options.RetryOptions;

            _innerClient = CreateTransportClient(tokenCredential, options);
        }
Пример #2
0
        /// <summary>
        ///   Initializes a new instance of the <see cref="ServiceBusConnection"/> class.
        /// </summary>
        ///
        /// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace to connect to.  This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
        /// <param name="credential">The Azure managed identity credential to use for authorization.  Access controls may be specified by the Service Bus namespace or the requested Service Bus entity, depending on Azure configuration.</param>
        /// <param name="options">A set of options to apply when configuring the connection.</param>
        internal ServiceBusConnection(
            string fullyQualifiedNamespace,
            TokenCredential credential,
            ServiceBusClientOptions options)
        {
            Argument.AssertWellFormedServiceBusNamespace(fullyQualifiedNamespace, nameof(fullyQualifiedNamespace));
            Argument.AssertNotNull(credential, nameof(credential));

            ValidateConnectionOptions(options);
            switch (credential)
            {
            case SharedAccessSignatureCredential _:
                break;

            case ServiceBusSharedKeyCredential sharedKeyCredential:
                credential = sharedKeyCredential.AsSharedAccessSignatureCredential(BuildAudienceResource(options.TransportType, fullyQualifiedNamespace, EntityPath));
                break;
            }

            var tokenCredential = new ServiceBusTokenCredential(credential, BuildAudienceResource(options.TransportType, fullyQualifiedNamespace, EntityPath));

            FullyQualifiedNamespace = fullyQualifiedNamespace;
            TransportType           = options.TransportType;
            RetryOptions            = options.RetryOptions;

#pragma warning disable CA2214 // Do not call overridable methods in constructors. This internal method is virtual for testing purposes.
            _innerClient = CreateTransportClient(tokenCredential, options);
#pragma warning restore CA2214 // Do not call overridable methods in constructors
        }
Пример #3
0
        /// <summary>
        ///   Initializes a new instance of the <see cref="ServiceBusConnection"/> class.
        /// </summary>
        ///
        /// <param name="connectionString">The connection string to use for connecting to the Service Bus namespace.</param>
        /// <param name="options">A set of options to apply when configuring the connection.</param>
        ///
        /// <remarks>
        ///   If the connection string is copied from the Service Bus entity itself, it will contain the name of the desired Service Bus entity,
        ///   and can be used directly without passing the  name="entityName" />.  The name of the Service Bus entity should be
        ///   passed only once, either as part of the connection string or separately.
        /// </remarks>
        ///
        internal ServiceBusConnection(
            string connectionString,
            ServiceBusClientOptions options)
        {
            Argument.AssertNotNullOrEmpty(connectionString, nameof(connectionString));
            Argument.AssertNotNull(options, nameof(options));

            options = options.Clone();

            ValidateConnectionOptions(options);
            var builder = new ServiceBusConnectionStringBuilder(connectionString);

            FullyQualifiedNamespace = builder.FullyQualifiedNamespace;
            TransportType           = options.TransportType;
            EntityPath = builder.EntityName;
            var sharedAccessSignature = new SharedAccessSignature
                                        (
                BuildAudienceResource(options.TransportType, FullyQualifiedNamespace, EntityPath),
                builder.SasKeyName,
                builder.SasKey
                                        );

            var sharedCredentials = new SharedAccessSignatureCredential(sharedAccessSignature);
            var tokenCredentials  = new ServiceBusTokenCredential(
                sharedCredentials,
                BuildAudienceResource(options.TransportType, FullyQualifiedNamespace, EntityPath));

            _innerClient = CreateTransportClient(tokenCredentials, options);
        }
        /// <summary>
        ///   Initializes a new instance of the <see cref="ServiceBusConnection"/> class.
        /// </summary>
        ///
        /// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace to connect to.  This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
        /// <param name="credential">The Azure managed identity credential to use for authorization.  Access controls may be specified by the Service Bus namespace or the requested Service Bus entity, depending on Azure configuration.</param>
        /// <param name="connectionOptions">A set of options to apply when configuring the connection.</param>
        ///
        internal ServiceBusConnection(
            string fullyQualifiedNamespace,
            TokenCredential credential,
            ServiceBusClientOptions connectionOptions = default)
        {
            Argument.AssertNotNullOrEmpty(fullyQualifiedNamespace, nameof(fullyQualifiedNamespace));
            Argument.AssertNotNull(credential, nameof(credential));

            connectionOptions = connectionOptions?.Clone() ?? new ServiceBusClientOptions();
            ValidateConnectionOptions(connectionOptions);
            switch (credential)
            {
            case SharedAccessSignatureCredential _:
                break;

            case ServiceBusSharedKeyCredential sharedKeyCredential:
                credential = sharedKeyCredential.AsSharedAccessSignatureCredential(BuildAudienceResource(connectionOptions.TransportType, fullyQualifiedNamespace, EntityName));
                break;
            }

            var tokenCredential = new ServiceBusTokenCredential(credential, BuildAudienceResource(connectionOptions.TransportType, fullyQualifiedNamespace, EntityName));

            FullyQualifiedNamespace = fullyQualifiedNamespace;
            TransportType           = connectionOptions.TransportType;

            _innerClient = CreateTransportClient(tokenCredential, connectionOptions);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceBusClient"/> class.
 /// </summary>
 ///
 /// <param name="connectionString">The connection string to use for connecting to the
 /// Service Bus namespace.</param>
 /// <param name="options">The set of <see cref="ServiceBusClientOptions"/> to use for
 /// configuring this <see cref="ServiceBusClient"/>.</param>
 ///
 /// <remarks>
 /// If the connection string specifies a specific entity name, any subsequent calls to
 /// <see cref="CreateSender(string)"/>, <see cref="CreateReceiver(string)"/>,
 /// <see cref="CreateProcessor(string)"/> etc. must still specify the same entity name.
 /// </remarks>
 public ServiceBusClient(string connectionString, ServiceBusClientOptions options)
 {
     Connection = new ServiceBusConnection(connectionString, options);
     Logger.ClientCreateStart(typeof(ServiceBusClient), FullyQualifiedNamespace);
     Options    = Connection.Options;
     Identifier = DiagnosticUtilities.GenerateIdentifier(FullyQualifiedNamespace);
     Logger.ClientCreateComplete(typeof(ServiceBusClient), Identifier);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceBusClient"/> class.
 /// </summary>
 ///
 /// <param name="connectionString">The connection string to use for connecting to the
 /// Service Bus namespace.</param>
 /// <param name="options">The set of <see cref="ServiceBusClientOptions"/> to use for
 /// configuring this <see cref="ServiceBusClient"/>.</param>
 ///
 /// <remarks>
 /// If the connection string specifies a specific entity name, any subsequent calls to
 /// <see cref="CreateSender(string)"/>, <see cref="CreateReceiver(string)"/>,
 /// <see cref="CreateProcessor(string)"/> etc. must still specify the same entity name.
 /// </remarks>
 public ServiceBusClient(string connectionString, ServiceBusClientOptions options)
 {
     _options   = options?.Clone() ?? new ServiceBusClientOptions();
     Connection = new ServiceBusConnection(connectionString, _options);
     Logger.ClientCreateStart(typeof(ServiceBusClient), FullyQualifiedNamespace);
     Identifier = DiagnosticUtilities.GenerateIdentifier(FullyQualifiedNamespace);
     Plugins    = _options.Plugins;
     Logger.ClientCreateComplete(typeof(ServiceBusClient), Identifier);
 }
 /// <summary>
 ///   Initializes a new instance of the <see cref="ServiceBusConnection"/> class.
 /// </summary>
 ///
 /// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace to connect to.  This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
 /// <param name="credential">The <see cref="AzureNamedKeyCredential"/> credential to use for authorization.  Access controls may be specified by the Service Bus namespace or the requested Service Bus entity, depending on Azure configuration.</param>
 /// <param name="options">A set of options to apply when configuring the connection.</param>
 internal ServiceBusConnection(
     string fullyQualifiedNamespace,
     AzureNamedKeyCredential credential,
     ServiceBusClientOptions options)
     : this(
         fullyQualifiedNamespace,
         TranslateNamedKeyCredential(credential, fullyQualifiedNamespace, null, options.TransportType),
         options)
 {
 }
 /// <summary>
 ///   Initializes a new instance of the <see cref="ServiceBusConnection"/> class.
 /// </summary>
 ///
 /// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace to connect to.  This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
 /// <param name="credential">The <see cref="AzureSasCredential"/> credential to use for authorization.  Access controls may be specified by the Service Bus namespace or the requested Service Bus entity, depending on Azure configuration.</param>
 /// <param name="options">A set of options to apply when configuring the connection.</param>
 internal ServiceBusConnection(
     string fullyQualifiedNamespace,
     AzureSasCredential credential,
     ServiceBusClientOptions options)
     : this(
         fullyQualifiedNamespace,
         new SharedAccessCredential(credential),
         options)
 {
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceBusClient"/> class.
 /// </summary>
 ///
 /// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace to connect to.
 /// This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
 /// <param name="credential">The Azure managed identity credential to use for authorization.  Access controls may be specified by the Service Bus namespace.</param>
 /// <param name="options">The set of <see cref="ServiceBusClientOptions"/> to use for configuring this <see cref="ServiceBusClient"/>.</param>
 public ServiceBusClient(
     string fullyQualifiedNamespace,
     TokenCredential credential,
     ServiceBusClientOptions options)
 {
     Identifier = DiagnosticUtilities.GenerateIdentifier(fullyQualifiedNamespace);
     Connection = new ServiceBusConnection(
         fullyQualifiedNamespace,
         credential,
         options);
     Options = Connection.Options;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceBusClient"/> class.
 /// </summary>
 ///
 /// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace to connect to.
 /// This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
 /// <param name="credential">The Azure managed identity credential to use for authorization.  Access controls may be specified by the Service Bus namespace.</param>
 /// <param name="options">The set of <see cref="ServiceBusClientOptions"/> to use for configuring this <see cref="ServiceBusClient"/>.</param>
 public ServiceBusClient(
     string fullyQualifiedNamespace,
     TokenCredential credential,
     ServiceBusClientOptions options)
 {
     Logger.ClientCreateStart(typeof(ServiceBusClient), fullyQualifiedNamespace);
     Identifier = DiagnosticUtilities.GenerateIdentifier(fullyQualifiedNamespace);
     Connection = new ServiceBusConnection(
         fullyQualifiedNamespace,
         credential,
         options);
     Options = Connection.Options;
     Logger.ClientCreateComplete(typeof(ServiceBusClient), Identifier);
 }
        /// <summary>
        ///   Builds a Service Bus client specific to the protocol and transport specified by the
        ///   requested connection type of the _connectionOptions />.
        /// </summary>
        ///
        /// <param name="credential">The Azure managed identity credential to use for authorization.</param>
        /// <param name="options"></param>
        ///
        /// <returns>A client generalization specific to the specified protocol/transport to which operations may be delegated.</returns>
        ///
        /// <remarks>
        ///   As an internal method, only basic sanity checks are performed against arguments.  It is
        ///   assumed that callers are trusted and have performed deep validation.
        ///
        ///   Parameters passed are also assumed to be owned by thee transport client and safe to mutate or dispose;
        ///   creation of clones or otherwise protecting the parameters is assumed to be the purview of the caller.
        /// </remarks>
        ///
        internal virtual TransportClient CreateTransportClient(
            ServiceBusTokenCredential credential,
            ServiceBusClientOptions options)
        {
            switch (TransportType)
            {
            case ServiceBusTransportType.AmqpTcp:
            case ServiceBusTransportType.AmqpWebSockets:
                return(new AmqpClient(FullyQualifiedNamespace, credential, options));

            default:
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources1.InvalidTransportType, options.TransportType.ToString()), nameof(options.TransportType));
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceBusClient"/> class.
 /// </summary>
 ///
 /// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace to connect to.
 /// This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
 /// <param name="credential">The <see cref="ServiceBusSharedAccessKeyCredential"/> to use for authorization.  Access controls may be specified by the Service Bus namespace.</param>
 /// <param name="options">The set of <see cref="ServiceBusClientOptions"/> to use for configuring this <see cref="ServiceBusClient"/>.</param>
 internal ServiceBusClient(
     string fullyQualifiedNamespace,
     ServiceBusSharedAccessKeyCredential credential,
     ServiceBusClientOptions options)
 {
     _options = options?.Clone() ?? new ServiceBusClientOptions();
     Logger.ClientCreateStart(typeof(ServiceBusClient), fullyQualifiedNamespace);
     Identifier = DiagnosticUtilities.GenerateIdentifier(fullyQualifiedNamespace);
     Connection = new ServiceBusConnection(
         fullyQualifiedNamespace,
         credential,
         _options);
     Plugins = _options.Plugins;
     Logger.ClientCreateComplete(typeof(ServiceBusClient), Identifier);
 }
        /// <summary>
        ///   Performs the actions needed to validate the <see cref="ServiceBusClientOptions" /> associated
        ///   with this client.
        /// </summary>
        ///
        /// <param name="connectionOptions">The set of options to validate.</param>
        ///
        /// <remarks>
        ///   In the case that the options violate an invariant or otherwise represent a combination that
        ///   is not permissible, an appropriate exception will be thrown.
        /// </remarks>
        ///
        private static void ValidateConnectionOptions(ServiceBusClientOptions connectionOptions)
        {
            // If there were no options passed, they cannot be in an invalid state.

            if (connectionOptions == null)
            {
                return;
            }

            // A proxy is only valid when web sockets is used as the transport.

            if ((!connectionOptions.TransportType.IsWebSocketTransport()) && (connectionOptions.Proxy != null))
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources1.ProxyMustUseWebSockets), nameof(connectionOptions));
            }
        }
        /// <summary>
        ///   Initializes a new instance of the <see cref="ServiceBusConnection"/> class.
        /// </summary>
        ///
        /// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace to connect to.  This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
        /// <param name="credential">The Azure managed identity credential to use for authorization.  Access controls may be specified by the Service Bus namespace or the requested Service Bus entity, depending on Azure configuration.</param>
        /// <param name="options">A set of options to apply when configuring the connection.</param>
        internal ServiceBusConnection(
            string fullyQualifiedNamespace,
            TokenCredential credential,
            ServiceBusClientOptions options)
        {
            Argument.AssertWellFormedServiceBusNamespace(fullyQualifiedNamespace, nameof(fullyQualifiedNamespace));
            Argument.AssertNotNull(credential, nameof(credential));
            ValidateConnectionOptions(options);

            var tokenCredential = new ServiceBusTokenCredential(credential);

            FullyQualifiedNamespace = fullyQualifiedNamespace;
            TransportType           = options.TransportType;
            RetryOptions            = options.RetryOptions;

#pragma warning disable CA2214 // Do not call overridable methods in constructors. This internal method is virtual for testing purposes.
            _innerClient = CreateTransportClient(tokenCredential, options);
#pragma warning restore CA2214 // Do not call overridable methods in constructors
        }
        /// <summary>
        ///   Initializes a new instance of the <see cref="ServiceBusConnection"/> class.
        /// </summary>
        ///
        /// <param name="connectionString">The connection string to use for connecting to the Service Bus namespace.</param>
        /// <param name="options">A set of options to apply when configuring the connection.</param>
        ///
        /// <remarks>
        ///   If the connection string is copied from the Service Bus entity itself, it will contain the name of the desired Service Bus entity,
        ///   and can be used directly without passing the  name="entityName" />.  The name of the Service Bus entity should be
        ///   passed only once, either as part of the connection string or separately.
        /// </remarks>
        ///
        internal ServiceBusConnection(
            string connectionString,
            ServiceBusClientOptions options)
        {
            Argument.AssertNotNullOrEmpty(connectionString, nameof(connectionString));

            options = options?.Clone() ?? new ServiceBusClientOptions();

            ValidateConnectionOptions(options);
            ConnectionStringProperties connectionStringProperties = ConnectionStringParser.Parse(connectionString);

            if (string.IsNullOrEmpty(connectionStringProperties.Endpoint?.Host) ||
                string.IsNullOrEmpty(connectionStringProperties.SharedAccessKeyName) ||
                string.IsNullOrEmpty(connectionStringProperties.SharedAccessKey))
            {
                throw new ArgumentException(Resources.MissingConnectionInformation, nameof(connectionString));
            }

            FullyQualifiedNamespace = connectionStringProperties.Endpoint.Host;
            TransportType           = options.TransportType;
            EntityPath   = connectionStringProperties.EntityPath;
            Options      = options;
            RetryOptions = options.RetryOptions;

            var sharedAccessSignature = new SharedAccessSignature
                                        (
                BuildAudienceResource(options.TransportType, FullyQualifiedNamespace, EntityPath),
                connectionStringProperties.SharedAccessKeyName,
                connectionStringProperties.SharedAccessKey
                                        );

            var sharedCredential = new SharedAccessSignatureCredential(sharedAccessSignature);
            var tokenCredential  = new ServiceBusTokenCredential(
                sharedCredential,
                BuildAudienceResource(TransportType, FullyQualifiedNamespace, EntityPath));

#pragma warning disable CA2214 // Do not call overridable methods in constructors. This internal method is virtual for testing purposes.
            _innerClient = CreateTransportClient(tokenCredential, options);
#pragma warning restore CA2214 // Do not call overridable methods in constructors
        }
        /// <summary>
        ///   Initializes a new instance of the <see cref="ServiceBusConnection"/> class.
        /// </summary>
        ///
        /// <param name="connectionString">The connection string to use for connecting to the Service Bus namespace.</param>
        /// <param name="options">A set of options to apply when configuring the connection.</param>
        ///
        /// <remarks>
        ///   If the connection string is copied from the Service Bus entity itself, it will contain the name of the desired Service Bus entity,
        ///   and can be used directly without passing the  name="entityName" />.  The name of the Service Bus entity should be
        ///   passed only once, either as part of the connection string or separately.
        /// </remarks>
        ///
        internal ServiceBusConnection(
            string connectionString,
            ServiceBusClientOptions options)
        {
            Argument.AssertNotNullOrEmpty(connectionString, nameof(connectionString));
            ValidateConnectionOptions(options);

            var connectionStringProperties = ConnectionStringParser.Parse(connectionString);

            ValidateConnectionStringProperties(connectionStringProperties, nameof(connectionString));

            FullyQualifiedNamespace = connectionStringProperties.Endpoint.Host;
            TransportType           = options.TransportType;
            EntityPath   = connectionStringProperties.EntityPath;
            RetryOptions = options.RetryOptions;

            SharedAccessSignature sharedAccessSignature;

            if (string.IsNullOrEmpty(connectionStringProperties.SharedAccessSignature))
            {
                sharedAccessSignature = new SharedAccessSignature(
                    BuildConnectionResource(options.TransportType, FullyQualifiedNamespace, EntityPath),
                    connectionStringProperties.SharedAccessKeyName,
                    connectionStringProperties.SharedAccessKey);
            }
            else
            {
                sharedAccessSignature = new SharedAccessSignature(connectionStringProperties.SharedAccessSignature);
            }

            var sharedCredential = new SharedAccessSignatureCredential(sharedAccessSignature);
            var tokenCredential  = new ServiceBusTokenCredential(
                sharedCredential,
                BuildConnectionResource(TransportType, FullyQualifiedNamespace, EntityPath));

#pragma warning disable CA2214 // Do not call overridable methods in constructors. This internal method is virtual for testing purposes.
            _innerClient = CreateTransportClient(tokenCredential, options);
#pragma warning restore CA2214 // Do not call overridable methods in constructors
        }
Пример #17
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connectionString"></param>
 /// <param name="options"></param>
 public ServiceBusClient(string connectionString, ServiceBusClientOptions options)
 {
     Connection = new ServiceBusConnection(connectionString, options);
 }
 /// <summary>
 ///   Creates an <see cref="ServiceBusConnection" /> based on the provided options and credential.
 /// </summary>
 ///
 /// <typeparam name="TCredential">The type of credential being used.</typeparam>
 ///
 /// <param name="fullyQualifiedNamespace">The fully qualified Event Hubs namespace to connect to.  This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
 /// <param name="credential">The credential to use for authorization.  This may be of type <see cref="TokenCredential" />, <see cref="AzureSasCredential" />, or <see cref="AzureNamedKeyCredential" />.</param>
 /// <param name="options">A set of options to apply when configuring the connection.</param>
 ///
 /// <returns>The connection that was created.</returns>
 ///
 /// <remarks>
 ///   Ownership of the connection is transferred to the caller.  The caller holds responsibility
 ///   for closing the connection and other cleanup activities.
 /// </remarks>
 ///
 internal static ServiceBusConnection CreateWithCredential <TCredential>(string fullyQualifiedNamespace,
                                                                         TCredential credential,
                                                                         ServiceBusClientOptions options) =>
 credential switch
 {
Пример #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="fullyQualifiedNamespace"></param>
 /// <param name="credential"></param>
 /// <param name="options"></param>
 public ServiceBusClient(string fullyQualifiedNamespace, TokenCredential credential, ServiceBusClientOptions options)
 {
     Connection = new ServiceBusConnection(
         fullyQualifiedNamespace,
         credential,
         options);
 }
Пример #20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="connectionString"></param>
 /// <param name="options"></param>
 public ServiceBusClient(string connectionString, ServiceBusClientOptions options)
 {
     Connection = new ServiceBusConnection(connectionString, options);
     Identifier = DiagnosticUtilities.GenerateIdentifier(Connection.FullyQualifiedNamespace);
     SubscriptionRuleManager = new ServiceBusSubscriptionRuleManager();
 }
Пример #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceBusClient"/> class.
 /// </summary>
 ///
 /// <param name="connectionString">The connection string to use for connecting to the
 /// Service Bus namespace.</param>
 /// <param name="options">The set of <see cref="ServiceBusClientOptions"/> to use for
 /// configuring this <see cref="ServiceBusClient"/>.</param>
 ///
 /// <remarks>
 /// If the connection string specifies a specific entity name, any subsequent calls to
 /// <see cref="CreateSender(string)"/>, <see cref="CreateReceiver(string)"/>,
 /// <see cref="CreateProcessor(string)"/> etc. must still specify the same entity name.
 /// </remarks>
 public ServiceBusClient(string connectionString, ServiceBusClientOptions options)
 {
     Connection = new ServiceBusConnection(connectionString, options);
     Options    = Connection.Options;
     Identifier = DiagnosticUtilities.GenerateIdentifier(Connection.FullyQualifiedNamespace);
 }