lib/rdkafka/config.rb in rdkafka-0.0.1 vs lib/rdkafka/config.rb in rdkafka-0.1.0
- old
+ new
@@ -1,9 +1,9 @@
module Rdkafka
class Config
DEFAULT_CONFIG = {
- "api.version.request" => "true"
+ :"api.version.request" => true
}
def initialize(config_hash = {})
@config_hash = DEFAULT_CONFIG.merge(config_hash)
end
@@ -15,11 +15,13 @@
def [](key)
@config_hash[key]
end
def consumer
- Rdkafka::Consumer.new(native_kafka(native_config, :rd_kafka_consumer))
+ kafka = native_kafka(native_config, :rd_kafka_consumer)
+ Rdkafka::FFI.rd_kafka_poll_set_consumer(kafka)
+ Rdkafka::Consumer.new(kafka)
end
def producer
# Create Kafka config
config = native_config
@@ -41,11 +43,11 @@
@config_hash.each do |key, value|
error_buffer = ::FFI::MemoryPointer.from_string(" " * 256)
result = Rdkafka::FFI.rd_kafka_conf_set(
config,
- key,
- value,
+ key.to_s,
+ value.to_s,
error_buffer,
256
)
unless result == :config_ok
raise ConfigError.new(error_buffer.read_string)