Ejemplo n.º 1
0
 public IWorkPolicyConclusion Analyze(IRequestResult<IProcessableUnit> result)
 {
     var conclusion = new WorkPolicyConclusion();
     conclusion.Completed = result.Success;
     if (!conclusion.Completed)
         ExamineFurther(conclusion, result);
     return conclusion;
 }
Ejemplo n.º 2
0
        public IWorkPolicyConclusion Analyze(IRequestResult <IProcessableUnit> result)
        {
            var conclusion = new WorkPolicyConclusion();

            conclusion.Completed = result.Success;
            if (!conclusion.Completed)
            {
                ExamineFurther(conclusion, result);
            }
            return(conclusion);
        }
Ejemplo n.º 3
0
 private void ExamineFurther(WorkPolicyConclusion conclusion, IRequestResult<IProcessableUnit> result)
 {
     var unit = result.Containee;
     var quality = unit.Subscription.QualityConstraints;
     if (quality.IsNotNull()) {
         var msg = result.Containee.Message;
         // If makes sense, allow retry
         conclusion.Retry = quality.GuaranteeDelivery && (msg.Retries < quality.MaxRetry);
         msg.Retries++;
         // If need delivery, but cannot retry, go to blocked status
         if (!conclusion.Retry && quality.GuaranteeDelivery) {
             conclusion.Block = true;
             Logger.LogInfo("Blocking subscription: " + unit.ToString());
         }
         conclusion.PassToFailureHandling = !conclusion.Retry && !conclusion.Block;
     }
 }
Ejemplo n.º 4
0
        private void ExamineFurther(WorkPolicyConclusion conclusion, IRequestResult <IProcessableUnit> result)
        {
            var unit    = result.Containee;
            var quality = unit.Subscription.QualityConstraints;

            if (quality.IsNotNull())
            {
                var msg = result.Containee.Message;
                // If makes sense, allow retry
                conclusion.Retry = quality.GuaranteeDelivery && (msg.Retries < quality.MaxRetry);
                msg.Retries++;
                // If need delivery, but cannot retry, go to blocked status
                if (!conclusion.Retry && quality.GuaranteeDelivery)
                {
                    conclusion.Block = true;
                    Logger.LogInfo("Blocking subscription: " + unit.ToString());
                }
                conclusion.PassToFailureHandling = !conclusion.Retry && !conclusion.Block;
            }
        }