Пример #1
0
        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);
            };
        }
Пример #2
0
 public Task ProcessErrorAsync(PartitionContext context, Exception error)
 {
     OnEventError?.Invoke(context, error);
     return(Task.CompletedTask);
 }