public DefaultTransientFaultHandler( Func <T> func, ITransientFaultDetecter <Exception> detecter, int retryThreshold) { this.Function = func; this.Detecter = detecter; this.RetryThreshold = retryThreshold; }
public static T Execute( Func <T> func, ITransientFaultDetecter <Exception> detecter, int retryThreshold) { var handler = new DefaultTransientFaultHandler <T>( func, detecter, retryThreshold); return(handler.Execute()); }
public static T GetResponse <T>( this string uri, Func <string, T> funcDeserialize, Func <HttpWebRequest, HttpWebRequest> funcSetCustomSettings = null, Encoding defaultEncoding = null, ITransientFaultDetecter <Exception> faultDetecter = null, int retryThreshold = 5) { return(funcDeserialize(uri.GetResponse( funcSetCustomSettings, defaultEncoding, faultDetecter, retryThreshold))); }
public static T GetResponseForJson <T>( this string uri, Func <HttpWebRequest, HttpWebRequest> funcSetCustomSettings = null, Encoding defaultEncoding = null, ITransientFaultDetecter <Exception> faultDetecter = null, int retryThreshold = 5) { return(uri.GetResponse( JsonExtension.DeserializeToObject <T>, funcSetCustomSettings, defaultEncoding, faultDetecter, retryThreshold)); }
public static string GetResponse( this string uri, Func <HttpWebRequest, HttpWebRequest> funcSetCustomSettings = null, Encoding defaultEncoding = null, ITransientFaultDetecter <Exception> faultDetecter = null, int retryThreshold = 5) { var faultHandler = new DefaultTransientFaultHandler <string>( () => { return(GetUriContentDirectly(uri, funcSetCustomSettings, defaultEncoding)); }, faultDetecter ?? new DefaultHttpTransientFaultDetecter(), retryThreshold); return(faultHandler.Execute()); }