/// <summary> /// Configures the specified host configurator. /// </summary> /// <param name="hostConfigurator">The host configurator.</param> protected override void Configure(HostConfigurator hostConfigurator) { var configuration = new Configuration { EventHubConnectionString = CloudConfigurationManager.GetSetting(nameof(Configuration.EventHubConnectionString)), StorageConnectionString = CloudConfigurationManager.GetSetting(nameof(Configuration.StorageConnectionString)), EventHubName = CloudConfigurationManager.GetSetting(nameof(Configuration.EventHubName)), Email = CloudConfigurationManager.GetSetting(nameof(Configuration.Email)), Identifier = RoleEnvironment.IsAvailable ? RoleEnvironment.CurrentRoleInstance.Id : Environment.MachineName }; _log.InfoFormat("Service Configuration: {0}", JsonConvert.SerializeObject(configuration)); hostConfigurator.Service(settings => new EventPubService(configuration), x => { x.BeforeStartingService(context => _log.Info("Service is being started")); x.AfterStoppingService(context => _log.Info("Service has stopped")); }); }
/// <summary> /// Initializes a new instance of the <see cref="EventPubService"/> class. /// </summary> /// <param name="configuration">The service configuration.</param> public EventPubService(Configuration configuration) { _configuration = configuration; }