Esempio n. 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);
            };
        }
Esempio n. 2
0
 public Task OpenAsync(PartitionContext context)
 {
     OnEventOpen?.Invoke(context);
     return(Task.CompletedTask);
 }