Closed fake-soul closed 3 hours ago
Works:
require 'rdkafka'
config = {
:"bootstrap.servers" => "localhost:9092",
:"group.id" => "ruby-test3",
:'auto.offset.reset' => 'earliest',
:'enable.auto.offset.store' => false
}
producer = Rdkafka::Config.new(config).producer
delivery_handles = []
100.times do |i|
puts "Producing message #{i}"
delivery_handles << producer.produce(
topic: "ruby-test-topic",
payload: "Payload #{i}",
key: "Key #{i}"
)
end
delivery_handles.each(&:wait)
consumer = Rdkafka::Config.new(config).consumer
consumer.subscribe("ruby-test-topic")
consumer.each do |message|
puts "Message received: #{message}"
consumer.store_offset(message)
end
Based on provided details, things operate as expected. If you want me to revisit this, please follow those guidelines: https://karafka.io/docs/Support/#issue-reporting-guide
This issue may occur if you do not follow the docs that clearly state:
When using this
enable.auto.offset.store
should be set tofalse
in the config.
Also keep in mind that this library is a low-level binding to librdkafka. You may be better using karafka that is built on top of it.
Description: I am encountering an issue with the
rdkafka
gem (version 0.18.0) when attempting to call the@consumer.store_offset(message)
method. The error message returned is:Environment:
Reproduction Steps:
Error Trace: The error occurs at the following locations:
../.rvm/gems/ruby-3.1.0/gems/rdkafka-0.18.0/lib/rdkafka/consumer.rb
Additional Information: This issue appears to have started from version
rdkafka
0.15.1, as the same code works correctly with versionrdkafka
0.15.0.I would appreciate any guidance or fixes regarding this issue.
Thank you!