/// <summary>
 ///     Set a custom partitioner that will be used for all topics
 ///     except those for which a partitioner has been explicitly configured.
 /// </summary>
 public ProducerBuilder <TKey, TValue> SetDefaultPartitioner(PartitionerDelegate partitioner)
 {
     if (this.DefaultPartitioner != null)
     {
         throw new ArgumentException("Default custom partitioner may only be specified once");
     }
     this.DefaultPartitioner = partitioner;
     return(this);
 }
 /// <summary>
 ///     Set a custom partitioner to use when producing messages to
 ///     <paramref name="topic" />.
 /// </summary>
 public ProducerBuilder <TKey, TValue> SetPartitioner(string topic, PartitionerDelegate partitioner)
 {
     if (string.IsNullOrWhiteSpace(topic))
     {
         throw new ArgumentException("Topic must not be null or empty");
     }
     if (this.Partitioners.ContainsKey(topic))
     {
         throw new ArgumentException($"Custom partitioner for {topic} already specified");
     }
     this.Partitioners.Add(topic, partitioner);
     return(this);
 }
 internal static extern void rd_kafka_topic_conf_set_partitioner_cb(
     IntPtr topic_conf, PartitionerDelegate partitioner_cb);
 internal static void topic_conf_set_partitioner_cb(
     IntPtr topic_conf, PartitionerDelegate partitioner_cb)
 => _topic_conf_set_partitioner_cb(topic_conf, partitioner_cb);