Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

How to registe ExceptionReceived by EventProcessorHost?

$
0
0

Currently, we use the EventProcessorHost to consume data, we want to catch the internal exception from the EventHub, so we use the ExceptionReceived event, below is the code:

var host = new EventProcessorHost(
                hostName,
                eventHubName,
                consumerGroupName,
                eventHubConnectionString,
                storageConnectionString, eventHubName.ToLowerInvariant());

   var factory = new DemoEventProcessorFactory(hostName);
   var options = new EventProcessorOptions();
   options.ExceptionReceived += OptionsOnExceptionReceived;
   await host.RegisterEventProcessorFactoryAsync(factory);

So we want to know is it the recommended way to do this? if not what is the right way? 


Viewing all articles
Browse latest Browse all 1916

Trending Articles