Пример #1
0
        private MetadataValidationResult ValidateBroker(Broker broker)
        {
            if (broker.BrokerId == -1)
            {
                return new MetadataValidationResult { Status = ValidationResult.Retry, ErrorCode = ErrorResponseCode.Unknown };
            }

            if (string.IsNullOrEmpty(broker.Host))
            {
                return new MetadataValidationResult
                {
                    Status = ValidationResult.Error,
                    Exception = new InvalidTopicMetadataException(ErrorResponseCode.NoError, "Broker missing host information.")
                };
            }

            if (broker.Port <= 0)
            {
                return new MetadataValidationResult
                {
                    Status = ValidationResult.Error,
                    Exception = new InvalidTopicMetadataException(ErrorResponseCode.NoError, "Broker missing port information.")
                };
            }

            return new MetadataValidationResult();
        }