public async Task Start() { _eventProcessorHost = new EventProcessorHost( _settings.EntityPath, PartitionReceiver.DefaultConsumerGroupName, _settings.ConnectionString, string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", _settings.StorageAccountName, _settings.StorageAccountKey), _settings.StorageContainerName); EventProcessorFactory <T> eventProcessorFactory = new EventProcessorFactory <T>(); await _eventProcessorHost.RegisterEventProcessorFactoryAsync(eventProcessorFactory); eventProcessorFactory.Processor.OnEventClose += (context, reason) => { OnEventClose?.Invoke(context, reason); }; eventProcessorFactory.Processor.OnEventOpen += (context) => { OnEventOpen?.Invoke(context); }; eventProcessorFactory.Processor.OnEventError += (context, error) => { OnEventError?.Invoke(context, error); }; eventProcessorFactory.Processor.OnProcessEvents += (context, eventMessages) => { OnProcessEvents?.Invoke(context, eventMessages); }; }
public Task OpenAsync(PartitionContext context) { OnEventOpen?.Invoke(context); return(Task.CompletedTask); }