 import ckafka
+
+let kSwiftKafkaCStringSize = 1024
 
 /// Enum representing the possible Kafka
 /// client types

        
    }
    
}

        return String(cString: rd_kafka_version_str())
    }
    
    // MARK: - Public Properties
    
    /// The current Kafka client type
    public let clientType: KafkaClientType
    
    /// The Kafka client name
    public var name: String? {
        
        guard let handle = kafkaClientHandle, let name = rd_kafka_name(handle) else {
            return nil
        }
        
        return String(cString: name)
        
    }
    
    /// The underlying librdkafka C pointer handle
    public private(set) var kafkaClientHandle: OpaquePointer?
    
    /// The currently set client configuration
    public private(set) var configuration: KafkaConfig?
    
    // MARK: - Initialiser
    public init(withClientType clientType: KafkaClientType,
                andConfig config: KafkaConfig? = nil) throws
    {
        
        if config == nil {
            configuration = try KafkaConfig()
        } else {
            configuration = config
        }
        
        let errString = UnsafeMutablePointer<CChar>.allocate(capacity: kSwiftKafkaCStringSize)
        
        defer {
            errString.deallocate(capacity: kSwiftKafkaCStringSize)
        }
        
        guard let kafkaClientHandle = rd_kafka_new(clientType.rdType(),
                                                   configuration?.configHandle,
                                                   errString,
                                                   kSwiftKafkaCStringSize) else
        {
            throw SwiftKafkaError.kafkaClientHandleInitFailed(String(cString: errString))
        }
        
        self.kafkaClientHandle = kafkaClientHandle
        self.clientType = clientType
        
    }
    
