KafkaClient
public class KafkaClient
A class for clients that will connect to a Kafka server.
This can either be a KafkaConsumer or a KafkaProducer.
-
Connect as a client to the servers (Kafka broker) at the provided addresses.
Usage Example:
let producer = try? KafkaProducer() let connectionCount = producer?.connect(brokers: "localhost:9092, localhost:9093") guard connectionCount == 2 else { print("Failed to connect to brokers") }Declaration
Swift
public func connect(brokers: String) -> IntReturn Value
The number of brokers that were successfully connected.
-
Connect as a client to the servers (Kafka broker) at the provided addresses.
Usage Example:
let producer = try? KafkaProducer() let connectionCount = producer?.connect(brokers: ["localhost:9092", "localhost:9093"]) guard connectionCount == 2 else { print("Failed to connect to brokers") }Declaration
Swift
public func connect(brokers: [String]) -> IntReturn Value
The number of brokers that were successfully connected.
-
Connect as a client to the servers (Kafka broker) at the provided addresses.
Usage Example:
let producer = try? KafkaProducer() let connectionCount = producer?.connect(brokers: ["localhost": 9092, "localhost": 9093]) guard connectionCount == 2 else { print("Failed to connect to brokers") }Declaration
Swift
public func connect(brokers: [String: Int]) -> IntReturn Value
The number of brokers that were successfully connected.
KafkaClient Class Reference