Example #1
0
        public override void ApplyResult(SignalWrapper <SignalEvent <TKey> > item
                                         , ProcessingResult result)
        {
            if (result == ProcessingResult.Success)
            {
                _signalFlushJob.Delete(item);
            }
            else if (result == ProcessingResult.Fail)
            {
                item.Signal.FailedAttempts++;
                item.IsUpdated = true;

                _signalFlushJob.Return(item);
            }
            else if (result == ProcessingResult.Repeat)
            {
                //received only limited number of subscribers, need to repeat for next limited batch of subscribers
                Append(item);
            }
            else if (result == ProcessingResult.NoHandlerFound)
            {
                _logger.LogError(SenderInternalMessages.EventQueue_HandlerNotFound, item.Signal.EventKey);
                _signalFlushJob.Delete(item);
            }
            else if (result == ProcessingResult.ReturnToStorage)
            {
                _signalFlushJob.Return(item);
            }
        }
 //apply result methods
 public override void ApplyResult(SignalWrapper <SignalDispatch <TKey> > item, ProcessingResult result)
 {
     if (result == ProcessingResult.Success)
     {
         //successfuly sent dispatch
         _signalFlushJob.Delete(item);
     }
     else if (result == ProcessingResult.Fail)
     {
         //dispatcher throws error
         IncrementFailedAttempts(item);
         Unlock(item);
         item.Signal.SendDateUtc = DateTime.UtcNow.Add(RetryPeriod);
         item.IsUpdated          = true;
         _signalFlushJob.Return(item);
     }
     else if (result == ProcessingResult.Repeat)
     {
         //dispatcher is not available
         Unlock(item);
         item.Signal.SendDateUtc = DateTime.UtcNow.Add(RetryPeriod);
         item.IsUpdated          = true;
         _signalFlushJob.Return(item);
     }
     else if (result == ProcessingResult.NoHandlerFound)
     {
         //no dispatcher found matching deliveryType
         IncrementFailedAttempts(item);
         Unlock(item);
         item.Signal.SendDateUtc = DateTime.UtcNow.Add(RetryPeriod);
         item.IsUpdated          = true;
         _signalFlushJob.Return(item);
     }
     else if (result == ProcessingResult.ReturnToStorage)
     {
         //1. stoped Sender and saving everything from queue to database
         //2. insert scheduled dispatch after it is composed
         Unlock(item);
         _signalFlushJob.Return(item);
     }
 }