Exemplo n.º 1
0
        private void ParkMessage(ResolvedEvent resolvedEvent, string reason, int count)
        {
            _settings.MessageParker.BeginParkMessage(resolvedEvent, reason, (e, result) => {
                if (result != OperationResult.Success)
                {
                    if (count < 5)
                    {
                        Log.Information("Unable to park message {stream}/{eventNumber} operation failed {e} retrying",
                                        e.OriginalStreamId,
                                        e.OriginalEventNumber, result);
                        ParkMessage(e, reason, count + 1);
                        return;
                    }

                    Log.Error(
                        "Unable to park message {stream}/{eventNumber} operation failed {e} after retries. Possible message loss",
                        e.OriginalStreamId,
                        e.OriginalEventNumber, result);
                }

                lock (_lock) {
                    _outstandingMessages.Remove(e.OriginalEvent.EventId);
                    _pushClients.RemoveProcessingMessages(e.OriginalEvent.EventId);
                    TryPushingMessagesToClients();
                }
            });
        }
Exemplo n.º 2
0
 private void RemoveProcessingMessages(Guid correlationId, Guid[] processedEventIds)
 {
     _pushClients.RemoveProcessingMessages(correlationId, processedEventIds);
     foreach (var id in processedEventIds)
     {
         _outstandingMessages.Remove(id);
     }
 }