Ejemplo n.º 1
0
 private static void ValidateConfig(EventHubConfig config, string eventHubType)
 {
     if (string.IsNullOrEmpty(config.ConnectionString))
     {
         Logger.LogError(string.Format("Missing value in app.config for {0} EventHub.",
                                       eventHubType), true);
     }
 }
Ejemplo n.º 2
0
        public static EventHubConfig GetDestinationEventHubConfig()
        {
            EventHubConfig eventHubConfig = new EventHubConfig()
            {
                ConnectionString = ConfigurationManager.AppSettings["destEhConnStr"]
            };

            ValidateConfig(eventHubConfig, "Destination");
            return(eventHubConfig);
        }
Ejemplo n.º 3
0
        public static EventHubConfig GetDestinationEventHubConfig(ILogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            EventHubConfig eventHubConfig = new EventHubConfig()
            {
                ConnectionString = ConfigurationManager.AppSettings["destEhConnStr"]
            };

            ValidateConfig(logger, eventHubConfig, "Destination");
            return(eventHubConfig);
        }
Ejemplo n.º 4
0
        private static void ValidateConfig(
            ILogger logger, EventHubConfig config, string eventHubType)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (string.IsNullOrEmpty(config.ConnectionString))
            {
                string message = $"Missing value in app.config for '{eventHubType}' EventHub.";
                logger.LogError(message);

                throw new NotSupportedException(message);
            }
        }