Пример #1
0
        /// <summary>
        /// Initialization of EventHub receiver is performed at adapter reciever initialization, but if it fails,
        ///  it will be retried when messages are requested
        /// </summary>
        /// <returns></returns>
        private async Task Initialize()
        {
            var watch = Stopwatch.StartNew();

            try
            {
                checkpointer = await checkpointerFactory(settings.Partition);

                cache          = cacheFactory(settings.Partition, checkpointer, baseLogger);
                flowController = new AggregatedQueueFlowController(MaxMessagesPerRead)
                {
                    cache, LoadShedQueueFlowController.CreateAsPercentOfLoadSheddingLimit(getNodeConfig)
                };
                string offset = await checkpointer.Load();

                receiver = await this.eventHubReceiverFactory(settings, offset, logger);

                watch.Stop();
                monitor?.TrackInitialization(true, watch.Elapsed, null);
            }
            catch (Exception ex)
            {
                watch.Stop();
                monitor?.TrackInitialization(false, watch.Elapsed, ex);
                throw;
            }
        }
        /// <summary>
        /// Initialization of EventHub receiver is performed at adapter receiver initialization, but if it fails,
        ///  it will be retried when messages are requested
        /// </summary>
        /// <returns></returns>
        private async Task Initialize()
        {
            var watch = Stopwatch.StartNew();

            try
            {
                this.checkpointer = await this.checkpointerFactory(this.settings.Partition);

                if (this.cache != null)
                {
                    this.cache.Dispose();
                    this.cache = null;
                }
                this.cache          = this.cacheFactory(this.settings.Partition, this.checkpointer, this.loggerFactory, this.telemetryProducer);
                this.flowController = new AggregatedQueueFlowController(MaxMessagesPerRead)
                {
                    this.cache, LoadShedQueueFlowController.CreateAsPercentOfLoadSheddingLimit(this.loadSheddingOptions)
                };
                string offset = await this.checkpointer.Load();

                this.receiver = this.eventHubReceiverFactory(this.settings, offset, this.logger, this.telemetryProducer);
                watch.Stop();
                this.monitor?.TrackInitialization(true, watch.Elapsed, null);
            }
            catch (Exception ex)
            {
                watch.Stop();
                this.monitor?.TrackInitialization(false, watch.Elapsed, ex);
                throw;
            }
        }
Пример #3
0
        public async Task Initialize(TimeSpan timeout)
        {
            checkpointer = await checkpointerFactory(config.Partition);

            cache          = cacheFactory(checkpointer);
            flowController = new AggregatedQueueFlowController(MaxMessagesPerRead)
            {
                cache
            };
            string offset = await checkpointer.Load();

            receiver = await CreateReceiver(config, offset);
        }
Пример #4
0
        /// <summary>
        /// Initialization of EventHub receiver is performed at adapter reciever initialization, but if it fails,
        ///  it will be retried when messages are requested
        /// </summary>
        /// <returns></returns>
        private async Task Initialize()
        {
            checkpointer = await checkpointerFactory(settings.Partition);

            cache          = cacheFactory(settings.Partition, checkpointer, baseLogger);
            flowController = new AggregatedQueueFlowController(MaxMessagesPerRead)
            {
                cache
            };
            string offset = await checkpointer.Load();

            receiver = await CreateReceiver(settings, offset, logger);
        }
Пример #5
0
        public async Task Initialize(TimeSpan timeout)
        {
            logger.Info("Initializing EventHub partition {0}-{1}.", config.Hub.Path, config.Partition);

            checkpointer = await checkpointerFactory(config.Partition);

            cache          = cacheFactory(config.Partition, checkpointer, baseLogger);
            flowController = new AggregatedQueueFlowController(MaxMessagesPerRead)
            {
                cache
            };
            string offset = await checkpointer.Load();

            receiver = await CreateReceiver(config, offset, logger);
        }
Пример #6
0
        /// <summary>
        /// Initialization of EventHub receiver is performed at adapter reciever initialization, but if it fails,
        ///  it will be retried when messages are requested
        /// </summary>
        /// <returns></returns>
        private async Task Initialize()
        {
            try
            {
                checkpointer = await checkpointerFactory(settings.Partition);

                cache          = cacheFactory(settings.Partition, checkpointer, baseLogger);
                flowController = new AggregatedQueueFlowController(MaxMessagesPerRead)
                {
                    cache, LoadShedQueueFlowController.CreateAsPercentOfLoadSheddingLimit()
                };
                string offset = await checkpointer.Load();

                receiver = await CreateReceiver(settings, offset, logger);

                monitor.TrackInitialization(true);
            }
            catch (Exception)
            {
                monitor.TrackInitialization(false);
                throw;
            }
        }