bool KeepAlive() { int minutes = 0; int failures = 0; IConsumerRegistrationContract cc = contract; while (failures < 5) { try { cc.KeepAlive(); minutes = 5; failures = 0; } catch (Exception ex) { failures += 1; Debug.WriteLine(String.Format("KeepAlive Exception {0}: {1}", failures, ex.Message), "AspenSinter"); Debug.WriteLine(ex.StackTrace, "AspenSinter"); minutes = 1; } System.Threading.Thread.Sleep(minutes * 60 * 1000); } Debug.WriteLine("KeepAlive Failed 10 consecutive times", "AspenSinter"); //stop = true; return(false); }
public static bool KeepAlive() { int minutes = 0; int failures = 0; //IConsumerRegistrationContract cc = AppUtility.GetConsumerRegistrationContract(); while (failures < 10) { try { cc.KeepAlive(); minutes = 5; failures = 0; } catch (Exception ex) { Debug.WriteLine("KeepAlive Exception: " + ex.Message, "SinterConsumerConsole"); Debug.WriteLine(ex.StackTrace, "SinterConsumerConsole"); minutes = 1; failures += 1; } System.Threading.Thread.Sleep(minutes * 60 * 1000); } return(false); }