KafkaProducer

public class KafkaProducer: KafkaClient

A threadsafe KafkaClient for producing messages to a topic on a broker.

Usage Example:

do {
    let producer = try KafkaProducer()
    producer.connect(brokers: "localhost:9092")
    producer.send(producerRecord: KafkaProducerRecord(topic: "test", value: "Hello World")) { result in
        switch result {
        case .success(let message):
            print("Message at offset \(message.offset) successfully sent")
        case .failure(let error):
            print("Error producing: \(error)")
        }
    }
} catch {
    print("Error creating producer: \(error)")
}