public static int GetCancellationDelayMaxMs()

in src/Epam.Kafka/KafkaConfigExtensions.cs [84:106]


    public static int GetCancellationDelayMaxMs(this ConsumerConfig config)
    {
        if (config == null) throw new ArgumentNullException(nameof(config));

        int result = DotnetCancellationDelayMaxMsDefault;

        string? s = config.Where(prop => prop.Key == DotnetCancellationDelayMaxMsKey).Select(a => a.Value).FirstOrDefault();

        if (s != null)
        {
            if (!int.TryParse(s, out result))
            {
                throw new ArgumentException($"'{DotnetCancellationDelayMaxMsKey}' must be a valid integer value.");
            }

            if (result is < DotnetCancellationDelayMaxMsMin or > DotnetCancellationDelayMaxMsMax)
            {
                throw new ArgumentOutOfRangeException(nameof(config), result, $"'{DotnetCancellationDelayMaxMsKey}' must be in the range {DotnetCancellationDelayMaxMsMin} <= '{DotnetCancellationDelayMaxMsKey}' <= {DotnetCancellationDelayMaxMsMax}");
            }
        }

        return result;
    }