/// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        internal static async Task <ServiceBusReceiver> CreateSessionReceiverAsync(
            string queueName,
            ServiceBusConnection connection,
            string sessionId = default,
            ServiceBusReceiverOptions options   = default,
            CancellationToken cancellationToken = default)
        {
            options = options?.Clone() ?? new ServiceBusReceiverOptions();

            var receiver = new ServiceBusReceiver(
                connection: connection,
                entityName: queueName,
                isSessionEntity: true,
                sessionId: sessionId,
                options: options);
            await receiver.OpenLinkAsync(cancellationToken).ConfigureAwait(false);

            return(receiver);
        }
示例#2
0
 public ReceiverManager(
     ServiceBusProcessor processor,
     EntityScopeFactory scopeFactory,
     IList <ServiceBusPlugin> plugins)
 {
     Processor        = processor;
     ProcessorOptions = processor.Options;
     _receiverOptions = new ServiceBusReceiverOptions
     {
         ReceiveMode   = ProcessorOptions.ReceiveMode,
         PrefetchCount = ProcessorOptions.PrefetchCount,
     };
     _maxReceiveWaitTime = ProcessorOptions.MaxReceiveWaitTime;
     _plugins            = plugins;
     Receiver            = new ServiceBusReceiver(
         connection: Processor.Connection,
         entityPath: Processor.EntityPath,
         isSessionEntity: false,
         plugins: _plugins,
         options: _receiverOptions);
     _scopeFactory = scopeFactory;
 }
示例#3
0
 public ReceiverManager(
     ServiceBusProcessor processor,
     EntityScopeFactory scopeFactory)
 {
     Processor        = processor;
     ProcessorOptions = processor.Options;
     _receiverOptions = new ServiceBusReceiverOptions
     {
         ReceiveMode   = ProcessorOptions.ReceiveMode,
         PrefetchCount = ProcessorOptions.PrefetchCount,
         // Pass None for subqueue since the subqueue has already
         // been taken into account when computing the EntityPath of the processor.
         SubQueue = SubQueue.None
     };
     _maxReceiveWaitTime = ProcessorOptions.MaxReceiveWaitTime;
     Receiver            = new ServiceBusReceiver(
         connection: Processor.Connection,
         entityPath: Processor.EntityPath,
         isSessionEntity: false,
         isProcessor: true,
         options: _receiverOptions);
     _scopeFactory = scopeFactory;
 }
示例#4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="queueName"></param>
 /// <param name="options"></param>
 /// <returns></returns>
 public ServiceBusReceiver GetReceiver(string queueName, ServiceBusReceiverOptions options) =>
 new ServiceBusReceiver(
     connection: Connection,
     entityPath: queueName,
     isSessionEntity: false,
     options: options);