private void ConfigureEventBus(IApplicationBuilder app) { //var svcHandler = new QuListener("rabbitmq"); //var qSvc = new PaymentService(); Action subscribeAct = () => { var svcHandler = app.ApplicationServices.GetRequiredService <QuListener>(); var qSvc = app.ApplicationServices.GetRequiredService <IPaymentService>(); svcHandler.Subscribe <IPaymentService>(qSvc); }; RetryHelper.AutoRetry(subscribeAct, 3); }
public void T_Retry() { // TODO: Add Testing logic here var xo = new OutService(); var ts = new TimeSpan(0, 0, 3); //Retry 間隔時間 int retryNum = 2; //Retry 之次數限制 try { RetryHelper.AutoRetry(() => xo.CallWebServiceFunction(), ts, retryNum); } catch (Exception e) { //Here! To Log Error! throw e; } }