public KafkaBuilder WithConfigPlaceholders()

in src/Epam.Kafka/KafkaBuilder.Placeholders.cs [27:57]


    public KafkaBuilder WithConfigPlaceholders(string key, string value)
    {
        if (!this._useConfiguration)
        {
            throw new InvalidOperationException(
                "Config placeholders can be used only for builder created with 'useConfiguration = true' parameter.");
        }

        const string name = "<name>";

        if (string.Equals(name, key, StringComparison.OrdinalIgnoreCase))
        {
            throw new ArgumentException($"Placeholder key {name} reserved and can't be used.", nameof(key));
        }

        KafkaConfigExtensions.ValidatePlaceholder(key, value);

        try
        {
            this._configPlaceholders.Add(key, value);
        }
        catch (ArgumentException e)
        {
            if (!string.Equals(value, this._configPlaceholders[key], StringComparison.Ordinal))
            {
                throw new ArgumentException($"Duplicate CASE INSENSITIVE key '{key}' with value that case sensitive not equal to existing.", nameof(key), e);
            }
        }

        return this;
    }