// read the BandontheRun.XXX related config from Azure portal or web.config private void GetEventHubConsumerGroupConfig(ref EventHubConfigInfo eventHubSettings) { eventHubSettings.consumerGroup = System.Configuration.ConfigurationManager.AppSettings["BandontheRun.consumerGroup"]; eventHubSettings.eventHubConnectionString = System.Configuration.ConfigurationManager.AppSettings["BandontheRun.eventHubConnectionString"]; eventHubSettings.storageConnectionString = System.Configuration.ConfigurationManager.AppSettings["BandontheRun.storageConnectionString"]; eventHubSettings.iotHubConnectionString = System.Configuration.ConfigurationManager.AppSettings["iotHubConnectionString"]; }
// read the BandontheRun.XXX related config from Azure portal or web.config private void GetEventHubConsumerGroupConfig(ref EventHubConfigInfo eventHubSettings) { eventHubSettings.eventHubNamespace = System.Configuration.ConfigurationManager.AppSettings["BandontheRun.eventHubNamespace"]; eventHubSettings.eventHubPath = System.Configuration.ConfigurationManager.AppSettings["BandontheRun.eventHubPath"]; eventHubSettings.SendKeyName = System.Configuration.ConfigurationManager.AppSettings["BandontheRun.SendKeyName"]; eventHubSettings.SendKeyValue = System.Configuration.ConfigurationManager.AppSettings["BandontheRun.SendKeyValue"]; eventHubSettings.consumerGroup = System.Configuration.ConfigurationManager.AppSettings["BandontheRun.consumerGroup"]; eventHubSettings.eventHubConnectionString = System.Configuration.ConfigurationManager.AppSettings["BandontheRun.eventHubConnectionString"]; eventHubSettings.storageConnectionString = System.Configuration.ConfigurationManager.AppSettings["BandontheRun.storageConnectionString"]; }
// create the EventProcessorHost consumer group that we will listen to data from our event hub private void CreateEventProcessorHostClient(ref EventHubConfigInfo eventHubSettings) { try { // we use the EventProcessorHost class to processes data from the Event Hub eventHubSettings.processorHost = new EventProcessorHost( this.Server.MachineName, eventHubSettings.eventHubPath, eventHubSettings.consumerGroup.ToLowerInvariant(), eventHubSettings.eventHubConnectionString, eventHubSettings.storageConnectionString); // could now add eventHubSettings.processorHostOptions if needed // wire up our class to handle events from event hub eventHubSettings.processorHost.RegisterEventProcessorAsync <WebsiteEventProcessor>().Wait(); } catch (Exception e) { Debug.Print("Error happened while trying to connect Event Hub - {0}", e.Message); } }
// create the EventProcessorHost consumer group that we will listen to data from our event hub private void CreateEventProcessorHostClient(ref EventHubConfigInfo eventHubSettings) { try { // we use the EventProcessorHost class to processes data from the Event Hub eventHubSettings.processorHost = new EventProcessorHost( this.Server.MachineName, eventHubSettings.eventHubPath, eventHubSettings.consumerGroup.ToLowerInvariant(), eventHubSettings.eventHubConnectionString, eventHubSettings.storageConnectionString); // could now add eventHubSettings.processorHostOptions if needed // wire up our class to handle events from event hub eventHubSettings.processorHost.RegisterEventProcessorAsync<WebsiteEventProcessor>().Wait(); } catch (Exception e) { Debug.Print("Error happened while trying to connect Event Hub - {0}", e.Message); } }