0

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)
  • Please don't post screenshots of code. Instead, please edit your question and add any code, error messages or similar directly into your question. That way, people can try it out and your question is accessible to search engines. – Holger Just Nov 23 '21 at 11:09
  • What exactly do you find difficult to understand? Please try to be more specific in your question, so that people know how to provide an adequate answer. – leifericf Nov 27 '21 at 15:20

0 Answers0