1

I'm using this gem for my Ruby on Rails Apps to produce and consume message from kafka server. https://karafka.io/docs/

and this is my karafka.rb file

# frozen_string_literal: true

class KarafkaApp < Karafka::App
  setup do |config|
    config.kafka = {"bootstrap.servers": ENV["KAFKA_BOOTSTRAP_SERVERS"]}
    config.client_id = "store"
    config.consumer_persistence = !Rails.env.development?
  end

  Karafka.monitor.subscribe(Karafka::Instrumentation::LoggerListener.new)
  
  Karafka.producer.monitor.subscribe(
    WaterDrop::Instrumentation::LoggerListener.new(Karafka.logger)
  )

  Karafka.monitor.subscribe "error.occurred" do |event|
    type = event[:type]
    error = event[:error]
    details = (error.backtrace || []).join("\n")

    puts "Oh no! An error: #{error} of type: #{type} occurred!"
    puts details
    puts "=" * 100
    NewRelic::Agent.notice_error(error)
  end

  routes.draw do
    topic "payment-order" do
      consumer PaymentOrderConsumer
    end

    topic "payment-method-config" do
      consumer PaymentMethodConsumer
    end

    topic "order-refund" do
      consumer OrderRefundConsumer
    end
  end
end

Karafka::Web.enable!

After quite sometimes, i got this error Error querying watermark offsets for partition 0 of karafka_consumers_states - Local: Unknown partition (unknown_partition) The consumer still consuming new message without problem, but i got error above periodically.

I'm not found another error on google.

I've tried install bash and librdkafka on server. Only using 1 kafka bootstrap server.

This is the topic already present on the kafka server. enter image description here

ramayeah
  • 39
  • 12

1 Answers1

1

I'm the Karafka author.

You did not follow the instructions thoughtfully. The web-ui requires a bootstrap: https://karafka.io/docs/Web-UI-Getting-Started/

Point 3:

Run the following command to install the karafka-web in your project:

bundle exec karafka-web install

Without that, Karafka Web-UI cannot get the expected data to operate.

You can either run the install or you can disable the web-ui. The choice is yours.

Karafka Web-UI provides a status page that can help you identify and mitigate problems that would cause the Web UI to malfunction or misbehave. If you see the 404 page or have issues with Karafka Web UI, this page is worth visiting.

karafka-web-status

  • Based on "consumer still consuming new message without problem", doesn't this mean the bootstrap server is correct? Wouldn't there be a different error if a network connection could not be established at all to the bootstrap? – OneCricketeer Jun 15 '23 at 19:19
  • @OneCricketeer no. Because what op refers to is the fact, that "his" topics are being consumed which is totally valid. The topics he listed exist and are being consumed. Web UI topics (topics created, managed and needed by the karafka web interface) are not. It's like having a DB with tables, where OP uses three tables and they work but the web UI requires extra table that is missing and only this part of the system fails. OP did not go through the install process of the web UI correctly. – Maciej Mensfeld Jun 16 '23 at 06:21
  • I see. I assumed Karafka was like other Kafka UI's that can also consume topics, as I see in the docs is a Pro feature – OneCricketeer Jun 16 '23 at 12:18
  • Karafka Web-UI is process-centric. Meaning it collects and reports various statistics about processes and it needs to store this data + aggregates somewhere. Not to force users into having anything else than Kafka (as they already have it) Karafka uses Kafka topics kinda like a KV. – Maciej Mensfeld Jun 16 '23 at 13:23
  • That wasn't really my point. The UI can find consume topics (according to the docs, as a Pro feature), and this is what I assumed OP was referring to – OneCricketeer Jun 17 '23 at 12:09
  • 1
    Ok, now I see your point. Yes, in a scenario like this, in case the topic would be gone during the index request, this could cause this error as well. However in this case, it's about the UI not having appropriate expected topics for data aggregation. – Maciej Mensfeld Jun 17 '23 at 15:34