/// <summary>
        /// Creates consumer settings
        /// </summary>
        /// <param name="config">Config to load properties from</param>
        /// <param name="keyDeserializer">Key deserializer</param>
        /// <param name="valueDeserializer">Value deserializer</param>
        /// <returns>Consumer settings</returns>
        /// <exception cref="ArgumentNullException">Thrown when kafka config for Akka.NET is not provided</exception>
        public static ConsumerSettings <TKey, TValue> Create(Akka.Configuration.Config config, IDeserializer <TKey> keyDeserializer, IDeserializer <TValue> valueDeserializer)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config), "Kafka config for Akka.NET consumer was not provided");
            }

            return(new ConsumerSettings <TKey, TValue>(
                       keyDeserializer: keyDeserializer,
                       valueDeserializer: valueDeserializer,
                       pollInterval: config.GetTimeSpan("poll-interval", TimeSpan.FromMilliseconds(50)),
                       pollTimeout: config.GetTimeSpan("poll-timeout", TimeSpan.FromMilliseconds(50)),
                       partitionHandlerWarning: config.GetTimeSpan("partition-handler-warning", TimeSpan.FromSeconds(5)),
                       commitTimeWarning: config.GetTimeSpan("commit-time-warning", TimeSpan.FromSeconds(1)),
                       commitTimeout: config.GetTimeSpan("commit-timeout", TimeSpan.FromSeconds(15)),
                       commitRefreshInterval: config.GetTimeSpan("commit-refresh-interval", Timeout.InfiniteTimeSpan, allowInfinite: true),
                       stopTimeout: config.GetTimeSpan("stop-timeout", TimeSpan.FromSeconds(30)),
                       positionTimeout: config.GetTimeSpan("position-timeout", TimeSpan.FromSeconds(5)),
                       waitClosePartition: config.GetTimeSpan("wait-close-partition", TimeSpan.FromSeconds(1)),
                       bufferSize: config.GetInt("buffer-size", 50),
                       drainingCheckInterval: config.GetTimeSpan("eos-draining-check-interval", TimeSpan.FromMilliseconds(30)),
                       dispatcherId: config.GetString("use-dispatcher", "akka.kafka.default-dispatcher"),
                       autoCreateTopicsEnabled: config.GetBoolean("allow.auto.create.topics", true),
                       properties: ImmutableDictionary <string, string> .Empty));
        }
        public static ProducerSettings <TKey, TValue> Create(Akka.Configuration.Config config, ISerializer <TKey> keySerializer, ISerializer <TValue> valueSerializer)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config), "Kafka config for Akka.NET producer was not provided");
            }

            return(new ProducerSettings <TKey, TValue>(
                       keySerializer: keySerializer,
                       valueSerializer: valueSerializer,
                       parallelism: config.GetInt("parallelism", 100),
                       dispatcherId: config.GetString("use-dispatcher", "akka.kafka.default-dispatcher"),
                       flushTimeout: config.GetTimeSpan("flush-timeout", TimeSpan.FromSeconds(2)),
                       eosCommitInterval: config.GetTimeSpan("eos-commit-interval", TimeSpan.FromMilliseconds(100)),
                       properties: ImmutableDictionary <string, string> .Empty));
        }