/// <summary> /// Create status listeners based off the health check configuration. /// </summary> /// <param name="configuration">The configuration for the health check.</param> /// <returns>A collection of listeners to receive health check results.</returns> public List <IStatusListener> CreateListeners(JobConfiguration configuration) { var listeners = new List <IStatusListener>(); if (!configuration.Listeners.Any()) { return(listeners); } foreach (var listenerXml in configuration.Listeners) { var type = ReadAttribute(listenerXml, "Type"); var listener = _factory.GetListener(type); _ = Enum.TryParse(ReadAttribute(listenerXml, "Threshold"), true, out CheckResult threshold); listener.Threshold = threshold; listener.Initialize(); listeners.Add(listener); } return(listeners); }