Skip to content

What is connection_builder in ruby kafka? #926

@SKG0811

Description

@SKG0811

This is not a bug.

I was trying to implement the functionalities of the gem ruby-kafka.

When trying out one of them(fetch_from_partition), I came across the connection_builder. I am finding it hard to understand more about the connection_builder. Any help here is appreciated! Below is the code snippet I was trying. I am sure that I am not doing it right here. Any help is appreciated.

  • Version of Ruby: 3.0.0
  • Version of Kafka: 2.8.1
  • Version of ruby-kafka: 1.4.0
Steps to reproduce
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
Expected outcome

Fetches messages from one or more partitions.

Actual outcome

NoMethodError (undefined method `hostname' for "localhost:9092":String)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions