Esempio 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;
 }
Esempio 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);
        }
Esempio 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;
     }
 }
Esempio 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;
            }
        }