I was trying to implement the functionalities of the gem ruby-kafka
.
When trying out one of them, I came across the connection_builder
. I am finding it hard to understand more about the connection_builder
.I dont know what needs to be passed as a connection_builder, Tried passing it with the 'localhost' but ended up getting the error. Any help here explaining what is connection_builder or what values needs to be passed is much appreciated! Below is the code snippet I was trying
bp = Kafka::BrokerPool.new(connection_builder: "localhost:9092", logger: Rails.logger)
cluster = Kafka::Cluster.new(seed_brokers: ["localhost:9092"], logger: Rails.logger, resolve_seed_brokers: false, broker_pool: bp)
operation = Kafka::FetchOperation.new(cluster: cluster, logger: Rails.logger, min_bytes: 1,max_wait_time: 10)
operation.fetch_from_partition("test-drive", 6,offset: :latest, max_bytes: 100000)
operation.execute
Error:
Traceback (most recent call last):
1: from (irb):75:in `<main>'
NoMethodError (undefined method `hostname' for "localhost:9092":String)