Exemple #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.Info("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.RemoveProcessingMessage(e.OriginalEvent.EventId);
                    TryPushingMessagesToClients();
                }
            });
        }