Beispiel #1
0
        private Task ExecuteAsync(object handler, IBehaviorContext context, int remaingCount)
        {
            IBehaviorContext contextState = context.Clone();

            try
            {
                return(context.NextAsync());
            }
            catch (Exception e)
            {
                remaingCount--;
                if (remaingCount > 0)
                {
                    int delay = (int)deplayBeforeReprocess.TotalMilliseconds;
                    if (delay > 0)
                    {
                        Thread.Sleep(delay);
                    }

                    Task result = ExecuteAsync(handler, contextState, remaingCount);
                    //context.CustomValues = contextState.CustomValues;
                    return(result);
                }

                throw e;
            }
        }