Пример #1
0
        private static void RetryHandleMessageOnError(RelayMessage message, Node node)
        {
            int         allowedRetries = NodeManager.Instance.GetRetryCountForMessage(message);
            List <Node> attemptedNodes = null;

            while (--allowedRetries >= 0 && message.IsRetryable(NodeManager.Instance.GetRelayRetryPolicyForMessage(message)))
            {
                if (attemptedNodes == null)
                {
                    attemptedNodes = new List <Node>(allowedRetries + 1);
                }

                attemptedNodes.Add(node);

                node = PrepareRetryMessage(message, attemptedNodes);
                if (node != null)
                {
                    node.HandleOutMessage(message);
                }
                else
                {
                    message.SetError(RelayErrorType.NoNodesAvailable);
                }
            }
        }