in RobotOrchestrator.OrderManager/Startup.cs [87:108]
private void ConfigureEventProcessorHostServices(IServiceCollection services)
{
services.AddSingleton<IEventProcessor, JobEventProcessor>();
services.AddSingleton<IEventProcessorFactory, IotHubEventProcessorFactory>();
services.AddSingleton<IEventProcessorHostConfig>(new EventProcessorHostConfig()
{
EventHubConnectionString = Configuration.GetValue<string>("OrderManagerEventHubConnectionString"),
ConsumerGroupName = Configuration.GetValue<string>("OrderManagerEventHubConsumerGroup"),
EventHubPath = Configuration.GetValue<string>("OrderManagerEventHubPath"),
StorageConnectionString = Configuration.GetValue<string>("BlobStorageConnectionString"),
LeaseContainerName = "orderleases"
});
services.Configure<EventProcessorOptions>(options =>
{
options.MaxBatchSize = 10;
options.PrefetchCount = 100;
options.InitialOffsetProvider = (partitionId) => EventPosition.FromEnqueuedTime(DateTime.UtcNow);
});
services.AddHostedService<IotHubListener>();
}