private void ConfigureEventProcessorHostServices()

in RobotOrchestrator.FleetManager/Startup.cs [92:113]


        private void ConfigureEventProcessorHostServices(IServiceCollection services)
        {
            services.AddSingleton<IEventProcessor, TelemetryEventProcessor>();
            services.AddSingleton<IEventProcessorFactory, IotHubEventProcessorFactory>();
            services.AddSingleton<IEventProcessorHostConfig>(new EventProcessorHostConfig()
            {
                EventHubConnectionString = Configuration.GetValue<string>("FleetManagerEventHubConnectionString"),
                ConsumerGroupName = Configuration.GetValue<string>("FleetManagerEventHubConsumerGroup"),
                EventHubPath = Configuration.GetValue<string>("FleetManagerEventHubPath"),
                StorageConnectionString = Configuration.GetValue<string>("BlobStorageConnectionString"),
                LeaseContainerName = "telemetryleases"
            });

            services.Configure<EventProcessorOptions>(options =>
            {
                options.MaxBatchSize = 10;
                options.PrefetchCount = 100;
                options.InitialOffsetProvider = (partitionId) => EventPosition.FromEnqueuedTime(DateTime.UtcNow);
            });

            services.AddHostedService<IotHubListener>();
        }