Пример #1
0
        public override TransportReceiveInfrastructure ConfigureReceiveInfrastructure()
        {
            var connectionObject = new ConnectionString(connectionString);
            var client           = CreateQueueClients.CreateReceiver(connectionObject);

            return(new TransportReceiveInfrastructure(
                       () =>
            {
                var addressing = GetAddressing(settings, connectionString);

                var unwrapper = settings.HasSetting <IMessageEnvelopeUnwrapper>() ? settings.GetOrDefault <IMessageEnvelopeUnwrapper>() : new DefaultMessageEnvelopeUnwrapper(serializer);

                var maximumWaitTime = settings.Get <TimeSpan>(WellKnownConfigurationKeys.ReceiverMaximumWaitTimeWhenIdle);
                var peekInterval = settings.Get <TimeSpan>(WellKnownConfigurationKeys.ReceiverPeekInterval);

                var receiver = new AzureMessageQueueReceiver(unwrapper, client, addressGenerator)
                {
                    MessageInvisibleTime = settings.Get <TimeSpan>(WellKnownConfigurationKeys.ReceiverMessageInvisibleTime),

                    BatchSize = settings.Get <int>(WellKnownConfigurationKeys.ReceiverBatchSize)
                };

                int?degreeOfReceiveParallelism = null;
                if (settings.TryGet <int>(WellKnownConfigurationKeys.DegreeOfReceiveParallelism, out var parallelism))
                {
                    degreeOfReceiveParallelism = parallelism;
                }

                return new MessagePump(receiver, addressing, degreeOfReceiveParallelism, maximumWaitTime, peekInterval);
            },
                       () => new AzureMessageQueueCreator(client, addressGenerator),
                       () => Task.FromResult(StartupCheckResult.Success)
                       ));
        }
 public MessagePump(AzureMessageQueueReceiver messageReceiver, AzureStorageAddressingSettings addressing, int?degreeOfReceiveParallelism, TimeSpan maximumWaitTime, TimeSpan peekInterval)
 {
     this.degreeOfReceiveParallelism = degreeOfReceiveParallelism;
     this.maximumWaitTime            = maximumWaitTime;
     this.peekInterval    = peekInterval;
     this.messageReceiver = messageReceiver;
     this.addressing      = addressing;
 }
 public MessageReceiver(string id,
                        TransportTransactionMode requiredTransactionMode,
                        AzureMessageQueueReceiver azureMessageQueueReceiver,
                        ISubscriptionManager subscriptionManager,
                        string receiveAddress,
                        string errorQueue,
                        Action <string, Exception, CancellationToken> criticalErrorAction,
                        int?degreeOfReceiveParallelism,
                        int?receiveBatchSize,
                        TimeSpan maximumWaitTime,
                        TimeSpan peekInterval)
 {
     Id = id;
     this.requiredTransactionMode    = requiredTransactionMode;
     this.receiveBatchSize           = receiveBatchSize;
     this.degreeOfReceiveParallelism = degreeOfReceiveParallelism;
     this.maximumWaitTime            = maximumWaitTime;
     this.peekInterval = peekInterval;
     this.azureMessageQueueReceiver = azureMessageQueueReceiver;
     Subscriptions            = subscriptionManager;
     this.receiveAddress      = receiveAddress;
     this.errorQueue          = errorQueue;
     this.criticalErrorAction = criticalErrorAction;
 }