public Listener(ITriggeredFunctionExecutor executor, KubernetesTriggerAttribute attribute) { _executor = executor; _attribute = attribute; _timer = new System.Timers.Timer(5 * 1000) { AutoReset = true }; _timer.Elapsed += OnTimer; }
public Task <ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context) { if (context == null) { throw new ArgumentNullException("context"); } var parameter = context.Parameter; KubernetesTriggerAttribute attribute = parameter.GetCustomAttribute <KubernetesTriggerAttribute>(inherit: false); if (attribute == null) { return(Task.FromResult <ITriggerBinding>(null)); } if (parameter.ParameterType != typeof(KubernetesTriggerValue) && parameter.ParameterType != typeof(string)) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Can't bind KubernetesTriggerAttribute to type '{0}'", parameter.ParameterType)); } return(Task.FromResult <ITriggerBinding>(new KubernetesTriggerBinding(context.Parameter))); }