popotte

popotte

Issue when using Brod: Bad generator when I run create_topic

Hello :slightly_smiling_face:

I have a problem with brod, I try to create a topic from brod :

use GenServer

  def start_link do
    GenServer.start_link(__MODULE__, :ok, name: __MODULE__)
  end

  @impl true
  def init(:ok) do
    case :brod.start_client([{"localhost", 9092}], :kafka_client, []) do
      :ok -> {:ok, nil}
      {:ok, _client_id} -> {:ok, nil}
      {:error, _reason} = error -> error
    end
  end

  def create_topic(topic_name) do
    :brod.create_topics(
      :kafka_client,
      [
        %{
          topic: topic_name,
          num_partitions: 3,
          replication_factor: 3,
          replica_assignment: [],
          config_entries: [
            %{
              config_name: "retention.ms",
              config_value: "-1"
            }
          ]
        }
      ],
      timeout: 30_000,
      validate_only: false
    )
  end

But I get this error :

[error] GenServer #PID<0.1145.0> terminating
** (stop) {:bad_generator, :kafka_client}
    (kafka_protocol 4.1.10) /home/shared/development/cyberbotz/projects/from-boilerplate/petal/botz_platform/deps/kafka_protocol/src/kpro_brokers.erl:317: :kpro_brokers."-random_order/1-lc$^0/1-0-"/1
    (kafka_protocol 4.1.10) /home/shared/development/cyberbotz/projects/from-boilerplate/petal/botz_platform/deps/kafka_protocol/src/kpro_brokers.erl:317: :kpro_brokers.random_order/1
    (kafka_protocol 4.1.10) /home/shared/development/cyberbotz/projects/from-boilerplate/petal/botz_platform/deps/kafka_protocol/src/kpro_brokers.erl:48: :kpro_brokers.connect_any/2
    (kafka_protocol 4.1.10) /home/shared/development/cyberbotz/projects/from-boilerplate/petal/botz_platform/deps/kafka_protocol/src/kpro_lib.erl:393: :kpro_lib.do_ok_pipe/1
    (kafka_protocol 4.1.10) /home/shared/development/cyberbotz/projects/from-boilerplate/petal/botz_platform/deps/kafka_protocol/src/kpro_lib.erl:304: anonymous fn/3 in :kpro_lib.with_timeout/2

Anyone know what I have to do?

Thanks :slightly_smiling_face:

Where Next?

Popular in Questions Top

RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement