public WeatherTriggerListener(ITriggeredFunctionExecutor executor,
                               IWeatherService weatherService, WeatherTriggerAttribute attribute)
 {
     this._executor       = executor;
     this._weatherService = weatherService;
     this._attribute      = attribute;
 }
 public WeatherTriggerBinding(ParameterInfo parameter, INameResolver nameResolver,
                              IWeatherService weatherService, WeatherTriggerAttribute attribute)
 {
     this._parameter      = parameter;
     this._nameResolver   = nameResolver;
     this._attribute      = attribute;
     this._weatherService = weatherService;
 }
        public WeatherTriggerListener(ITriggeredFunctionExecutor executor,
                                      IWeatherService weatherService, WeatherTriggerAttribute attribute, ILoggerFactory loggerFactory)
        {
            this._executor       = executor;
            this._weatherService = weatherService;
            this._attribute      = attribute;
            this._loggerFactory  = loggerFactory;

            this._logger = this._loggerFactory.CreateLogger <WeatherTriggerListener>();
        }
        public WeatherTriggerBinding(ParameterInfo parameter, INameResolver nameResolver,
                                     IWeatherService weatherService, WeatherTriggerAttribute attribute,
                                     ILoggerFactory loggerFactory)
        {
            this._parameter      = parameter;
            this._nameResolver   = nameResolver;
            this._attribute      = attribute;
            this._weatherService = weatherService;
            this._loggerFactory  = loggerFactory;

            this._logger = this._loggerFactory.CreateLogger <WeatherTriggerBinding>();
        }
Beispiel #5
0
        private string GetTriggerAttributeApiKey(WeatherTriggerAttribute triggerAttribute)
        {
            if (string.IsNullOrEmpty(triggerAttribute.ApiKey))
            {
                var apiKey = _nameResolver.Resolve("Weather.ApiKey");

                if (string.IsNullOrEmpty(apiKey))
                {
                    throw new InvalidOperationException("ApiKey is mandatory");
                }

                return(apiKey);
            }

            return(triggerAttribute.ApiKey);
        }
Beispiel #6
0
        private int GetTriggerAttributeSecondsBetweenCheck(WeatherTriggerAttribute triggerAttribute)
        {
            if (triggerAttribute.SecondsBetweenCheck <= 0)
            {
                var secondsBetweenCheckConfig = _nameResolver.Resolve("Weather.SecondsBetweenCheck");

                if (string.IsNullOrEmpty(secondsBetweenCheckConfig) ||
                    (!int.TryParse(secondsBetweenCheckConfig, out var secondsBetweenCheck) && secondsBetweenCheck <= 0))
                {
                    return(30);
                }

                return(secondsBetweenCheck);
            }

            return(triggerAttribute.SecondsBetweenCheck);
        }