Beispiel #1
0
 private void AddProblemAggregateMailBoxToDict(ProcessingEventMailBox mailbox)
 {
     if (_problemAggregateRootMailBoxDict.TryAdd(mailbox.AggregateRootId, mailbox))
     {
         _logger.WarnFormat("Added problem aggregate mailbox, aggregateRootTypeName: {0}, aggregateRootId: {1}", mailbox.AggregateRootTypeName, mailbox.AggregateRootId);
     }
 }
Beispiel #2
0
 private void TryToRefreshAggregateMailBoxNextExpectingEventVersion(ProcessingEventMailBox processingEventMailBox)
 {
     if (_refreshingAggregateRootDict.TryAdd(processingEventMailBox.AggregateRootId, true))
     {
         GetAggregateRootLatestPublishedEventVersion(processingEventMailBox, 0);
     }
 }
Beispiel #3
0
 private void AddToRefreshAggregateMailBoxToDict(ProcessingEventMailBox mailbox)
 {
     if (_toRefreshAggregateRootMailBoxDict.TryAdd(mailbox.AggregateRootId, mailbox))
     {
         _logger.InfoFormat("Added toRefreshPublishedVersion aggregate mailbox, aggregateRootTypeName: {0}, aggregateRootId: {1}", mailbox.AggregateRootTypeName, mailbox.AggregateRootId);
         TryToRefreshAggregateMailBoxNextExpectingEventVersion(mailbox);
     }
 }
Beispiel #4
0
 private void TryToRefreshAggregateMailBoxNextExpectingEventVersion(ProcessingEventMailBox processingEventMailBox)
 {
     if (_refreshingAggregateRootDict.TryAdd(processingEventMailBox.AggregateRootId, true))
     {
         Task.Factory.StartNew(async() =>
         {
             var latestPublishedEventVersion = await GetAggregateRootLatestPublishedEventVersion(processingEventMailBox.AggregateRootTypeName, processingEventMailBox.AggregateRootId);
             processingEventMailBox.SetNextExpectingEventVersion(latestPublishedEventVersion + 1);
             _refreshingAggregateRootDict.TryRemove(processingEventMailBox.AggregateRootId, out bool removed);
         });
     }
 }
Beispiel #5
0
 private void GetAggregateRootLatestPublishedEventVersion(ProcessingEventMailBox processingEventMailBox, int retryTimes)
 {
     _ioHelper.TryAsyncActionRecursively("GetAggregateRootLatestPublishedEventVersion",
                                         () => _publishedVersionStore.GetPublishedVersionAsync(Name, processingEventMailBox.AggregateRootTypeName, processingEventMailBox.AggregateRootId),
                                         currentRetryTimes => GetAggregateRootLatestPublishedEventVersion(processingEventMailBox, currentRetryTimes),
                                         result =>
     {
         processingEventMailBox.SetNextExpectingEventVersion(result + 1);
         _refreshingAggregateRootDict.TryRemove(processingEventMailBox.AggregateRootId, out bool removed);
     },
                                         () => string.Format("_publishedVersionStore.GetPublishedVersionAsync has unknown exception, aggregateRootTypeName: {0}, aggregateRootId: {1}", processingEventMailBox.AggregateRootTypeName, processingEventMailBox.AggregateRootId),
                                         null,
                                         retryTimes, true);
 }
Beispiel #6
0
 private bool IsMailBoxAllowRemove(ProcessingEventMailBox mailbox)
 {
     return(mailbox.IsInactive(_timeoutSeconds) && !mailbox.IsRunning && mailbox.TotalUnHandledMessageCount == 0 && mailbox.WaitingMessageCount == 0);
 }
Beispiel #7
0
 private void AddProblemAggregateMailBoxToDict(ProcessingEventMailBox mailbox)
 {
     _problemAggregateRootMailBoxDict.TryAdd(mailbox.AggregateRootId, mailbox);
 }