internal SafeTopicHandle Topic(string topic, IntPtr config)
        {
            // Increase the refcount to this handle to keep it alive for
            // at least as long as the topic handle.
            // Will be decremented by the topic handle ReleaseHandle.
            bool success = false;

            DangerousAddRef(ref success);
            if (!success)
            {
                LibRdKafka.topic_conf_destroy(config);
                throw new Exception("Failed to create topic (DangerousAddRef failed)");
            }
            var topicHandle = LibRdKafka.topic_new(handle, topic, config);

            if (topicHandle.IsInvalid)
            {
                DangerousRelease();
                throw RdKafkaException.FromErr(LibRdKafka.last_error(), "Failed to create topic");
            }
            topicHandle.kafkaHandle = this;
            return(topicHandle);
        }