///// <summary> ///// Initializes a new instance of the <see cref="ServiceBusReceiver"/> class. ///// </summary> ///// ///// <param name="connectionString">The connection string to use for connecting to the Service Bus namespace; it is expected that the shared key properties are contained in this connection string, but not the Service Bus entity name.</param> ///// <param name="entityName">The name of the specific Service Bus entity to associate the consumer with.</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 <paramref name="entityName" />. The name of the Service Bus entity should be ///// passed only once, either as part of the connection string or separately. ///// </remarks> ///// //public ServiceBusReceiver( // string connectionString, // string entityName) : // this( // connectionString, // entityName, // null, // new ServiceBusReceiverClientOptions()) //{ //} ///// <summary> ///// Initializes a new instance of the <see cref="ServiceBusReceiver"/> class. ///// </summary> ///// ///// <param name="connectionString">The connection string to use for connecting to the Service Bus namespace; it is expected that the shared key properties are contained in this connection string, but not the Service Bus entity name.</param> ///// <param name="entityName">The name of the specific Service Bus entity to associate the consumer with.</param> ///// <param name="clientOptions"></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 <paramref name="entityName" />. The name of the Service Bus entity should be ///// passed only once, either as part of the connection string or separately. ///// </remarks> ///// //public ServiceBusReceiver( // string connectionString, // string entityName, // ServiceBusReceiverClientOptions clientOptions) : // this( // connectionString, // entityName, // null, // clientOptions?.Clone() ?? new ServiceBusReceiverClientOptions()) //{ //} /// <summary> /// Initializes a new instance of the <see cref="ServiceBusReceiver"/> 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="entityName">The name of the specific Service Bus entity to associate the consumer with.</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="sessionOptions"></param> /// <param name="clientOptions">A set of options to apply when configuring the consumer.</param> /// internal ServiceBusReceiver( string fullyQualifiedNamespace, string entityName, TokenCredential credential, SessionOptions sessionOptions, ServiceBusReceiverClientOptions clientOptions) { Argument.AssertNotNullOrEmpty(fullyQualifiedNamespace, nameof(fullyQualifiedNamespace)); Argument.AssertNotNullOrEmpty(entityName, nameof(entityName)); Argument.AssertNotNull(credential, nameof(credential)); Argument.AssertNotNull(clientOptions, nameof(clientOptions)); IsSessionReceiver = sessionOptions != null; OwnsConnection = true; Connection = new ServiceBusConnection(fullyQualifiedNamespace, entityName, credential, clientOptions.ConnectionOptions); RetryPolicy = clientOptions.RetryOptions.ToRetryPolicy(); ReceiveMode = clientOptions.ReceiveMode; Consumer = Connection.CreateTransportConsumer( retryPolicy: RetryPolicy, receiveMode: ReceiveMode, prefetchCount: PrefetchCount, sessionId: sessionOptions?.SessionId, isSessionReceiver: IsSessionReceiver); Session = new ServiceBusSession( Consumer, RetryPolicy); }
/// <summary> /// Initializes a new instance of the <see cref="ServiceBusReceiverClient"/> class. /// </summary> /// /// <param name="connection">The <see cref="ServiceBusConnection" /> connection to use for communication with the Service Bus service.</param> /// <param name="sessionId"></param> /// <param name="clientOptions">A set of options to apply when configuring the consumer.</param> /// internal ServiceBusReceiverClient( ServiceBusConnection connection, string sessionId, ServiceBusReceiverClientOptions clientOptions) { Argument.AssertNotNull(connection, nameof(connection)); Argument.AssertNotNull(clientOptions, nameof(clientOptions)); OwnsConnection = false; Connection = connection; RetryPolicy = clientOptions.RetryOptions.ToRetryPolicy(); ReceiveMode = clientOptions.ReceiveMode; Consumer = Connection.CreateTransportConsumer(retryPolicy: RetryPolicy, sessionId: sessionId); }
/// <summary> /// Initializes a new instance of the <see cref="ServiceBusReceiverClient"/> class. /// </summary> /// /// <param name="connectionString">The connection string to use for connecting to the Service Bus namespace; it is expected that the shared key properties are contained in this connection string, but not the Service Bus entity name.</param> /// <param name="entityName">The name of the specific Service Bus entity to associate the consumer with.</param> /// <param name="clientOptions">A set of options to apply when configuring the consumer.</param> /// <param name="sessionId"></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 <paramref 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 ServiceBusReceiverClient( string connectionString, string entityName, string sessionId, ServiceBusReceiverClientOptions clientOptions) { Argument.AssertNotNullOrEmpty(connectionString, nameof(connectionString)); Argument.AssertNotNull(clientOptions, nameof(clientOptions)); OwnsConnection = true; Connection = new ServiceBusConnection(connectionString, entityName, clientOptions.ConnectionOptions); RetryPolicy = clientOptions.RetryOptions.ToRetryPolicy(); ReceiveMode = clientOptions.ReceiveMode; Consumer = Connection.CreateTransportConsumer(retryPolicy: RetryPolicy, sessionId: sessionId); }
/// <summary> /// Initializes a new instance of the <see cref="ServiceBusReceiverClient"/> 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="entityName">The name of the specific Service Bus entity to associate the consumer with.</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="sessionId"></param> /// <param name="clientOptions">A set of options to apply when configuring the consumer.</param> /// internal ServiceBusReceiverClient( string fullyQualifiedNamespace, string entityName, TokenCredential credential, string sessionId, ServiceBusReceiverClientOptions clientOptions) { Argument.AssertNotNullOrEmpty(fullyQualifiedNamespace, nameof(fullyQualifiedNamespace)); Argument.AssertNotNullOrEmpty(entityName, nameof(entityName)); Argument.AssertNotNull(credential, nameof(credential)); Argument.AssertNotNull(clientOptions, nameof(clientOptions)); OwnsConnection = true; Connection = new ServiceBusConnection(fullyQualifiedNamespace, entityName, credential, clientOptions.ConnectionOptions); RetryPolicy = clientOptions.RetryOptions.ToRetryPolicy(); ReceiveMode = clientOptions.ReceiveMode; Consumer = Connection.CreateTransportConsumer(retryPolicy: RetryPolicy, sessionId: sessionId); }
/// <summary> /// Initializes a new instance of the <see cref="ServiceBusReceiver"/> class. /// </summary> /// /// <param name="connection">The <see cref="ServiceBusConnection" /> connection to use for communication with the Service Bus service.</param> /// <param name="sessionOptions"></param> /// <param name="clientOptions">A set of options to apply when configuring the consumer.</param> /// internal ServiceBusReceiver( ServiceBusConnection connection, SessionOptions sessionOptions, ServiceBusReceiverClientOptions clientOptions) { Argument.AssertNotNull(connection, nameof(connection)); Argument.AssertNotNull(clientOptions, nameof(clientOptions)); IsSessionReceiver = sessionOptions != null; OwnsConnection = false; Connection = connection; RetryPolicy = clientOptions.RetryOptions.ToRetryPolicy(); ReceiveMode = clientOptions.ReceiveMode; Consumer = Connection.CreateTransportConsumer( retryPolicy: RetryPolicy, prefetchCount: PrefetchCount, sessionId: sessionOptions?.SessionId, isSessionReceiver: IsSessionReceiver); Session = new ServiceBusSession( Consumer, RetryPolicy); }
///// <summary> ///// Initializes a new instance of the <see cref="ServiceBusReceiver"/> class. ///// </summary> ///// ///// <param name="connectionString">The connection string to use for connecting to the Service Bus namespace; it is expected that the shared key properties are contained in this connection string, but not the Service Bus entity name.</param> ///// <param name="entityName">The name of the specific Service Bus entity to associate the consumer with.</param> ///// <param name="sessionOptions"></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 <paramref name="entityName" />. The name of the Service Bus entity should be ///// passed only once, either as part of the connection string or separately. ///// </remarks> ///// //public ServiceBusReceiver( // string connectionString, // string entityName, // SessionOptions sessionOptions) : // this( // connectionString, // entityName, // sessionOptions, // new ServiceBusReceiverClientOptions()) //{ //} /// <summary> /// Initializes a new instance of the <see cref="ServiceBusReceiver"/> class. /// </summary> /// /// <param name="connectionString">The connection string to use for connecting to the Service Bus namespace; it is expected that the shared key properties are contained in this connection string, but not the Service Bus entity name.</param> /// <param name="entityName">The name of the specific Service Bus entity to associate the consumer with.</param> /// <param name="clientOptions">A set of options to apply when configuring the consumer.</param> /// <param name="sessionOptions"></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 <paramref 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 ServiceBusReceiver( string connectionString, string entityName, SessionOptions sessionOptions, ServiceBusReceiverClientOptions clientOptions) { Argument.AssertNotNullOrEmpty(connectionString, nameof(connectionString)); Argument.AssertNotNull(clientOptions, nameof(clientOptions)); IsSessionReceiver = sessionOptions != null; OwnsConnection = true; Connection = new ServiceBusConnection(connectionString, entityName, clientOptions.ConnectionOptions); RetryPolicy = clientOptions.RetryOptions.ToRetryPolicy(); ReceiveMode = clientOptions.ReceiveMode; Consumer = Connection.CreateTransportConsumer( retryPolicy: RetryPolicy, prefetchCount: PrefetchCount, sessionId: sessionOptions?.SessionId, isSessionReceiver: IsSessionReceiver); Session = new ServiceBusSession( Consumer, RetryPolicy); }