private void HandleOnMessageFailed(FailedMessage failedMessage) { lock (failedMessages) if (!failedMessages.Contains(failedMessage)) { failedMessages.Add(failedMessage); domainEvents.Publish(new FailedMessageDetectedEvent { FailedMessage = failedMessage }); } }