示例#1
0
        public EventHubListener(
            string functionId,
            ITriggeredFunctionExecutor executor,
            EventProcessorHost eventProcessorHost,
            bool singleDispatch,
            IEventHubConsumerClient consumerClient,
            BlobsCheckpointStore checkpointStore,
            EventHubOptions options,
            ILoggerFactory loggerFactory)
        {
            _loggerFactory      = loggerFactory;
            _executor           = executor;
            _eventProcessorHost = eventProcessorHost;
            _singleDispatch     = singleDispatch;
            _checkpointStore    = checkpointStore;
            _options            = options;
            _logger             = _loggerFactory.CreateLogger <EventHubListener>();

            _scaleMonitor = new Lazy <EventHubsScaleMonitor>(
                () => new EventHubsScaleMonitor(
                    functionId,
                    consumerClient,
                    checkpointStore,
                    _loggerFactory.CreateLogger <EventHubsScaleMonitor>()));

            _details = $"'namespace='{eventProcessorHost?.FullyQualifiedNamespace}', eventHub='{eventProcessorHost?.EventHubName}', " +
                       $"consumerGroup='{eventProcessorHost?.ConsumerGroup}', functionId='{functionId}', singleDispatch='{singleDispatch}'";
        }
        public EventHubsScaleMonitor(
            string functionId,
            IEventHubConsumerClient client,
            BlobsCheckpointStore checkpointStore,
            ILogger logger)
        {
            _functionId               = functionId;
            _logger                   = logger;
            _checkpointStore          = checkpointStore;
            _nextPartitionLogTime     = DateTime.UtcNow;
            _nextPartitionWarningTime = DateTime.UtcNow;
            _client                   = client;

            Descriptor = new ScaleMonitorDescriptor($"{_functionId}-EventHubTrigger-{_client.EventHubName}-{_client.ConsumerGroup}".ToLowerInvariant());
        }
        public EventHubListener(
            string functionId,
            ITriggeredFunctionExecutor executor,
            EventProcessorHost eventProcessorHost,
            bool singleDispatch,
            IEventHubConsumerClient consumerClient,
            BlobsCheckpointStore checkpointStore,
            EventHubOptions options,
            ILogger logger)
        {
            _logger             = logger;
            _executor           = executor;
            _eventProcessorHost = eventProcessorHost;
            _singleDispatch     = singleDispatch;
            _checkpointStore    = checkpointStore;
            _options            = options;

            _scaleMonitor = new Lazy <EventHubsScaleMonitor>(
                () => new EventHubsScaleMonitor(
                    functionId,
                    consumerClient,
                    checkpointStore,
                    _logger));
        }