Open hy05190134 opened 9 years ago
@hy05190134 brokers is not empty, cause it may not be an array, this depend on broker.id in your kafka config
you can try
lua ngx.say("brokers: ", cjson.encode(brokers), "; partitions: ", cjson.encode(partitions))
cjson.encode(brokers) return nil which I ever use
but I directly use producer:new and send function, I find it works well
@hy05190134 It sounds impossible, can you try the sample code again and show me the original result ?
I got the same problem
local cli = client:new(broker_list)
local brokers, partitions = cli:fetch_metadata(kafka.topic)
if not brokers then
ngx.log(ngx.ERR, "fetch_metadata failed, err:", partitions)
end
ngx.log(ngx.ERR, "brokers: ", #brokers, "; partitions: ", cjson.encode(partitions))
I use the code above in my macos environment and I can ensure the broker_list is available and is it bug to just return a empty brokers? but partitions info is ok