doujiang24 / lua-resty-kafka

Lua kafka client driver for the Openresty based on the cosocket API
BSD 3-Clause "New" or "Revised" License
803 stars 277 forks source link

The timestamp of kafka is -1 #158

Open junchuLF opened 1 year ago

junchuLF commented 1 year ago

lua_resty_kafka Version is 0.22 . api_version = 2
The message timestamp received by Kafka is -1

image
vantsiforov commented 1 year ago

in producer.lua in line 32 i've remove "not"

when it's if self.api_version then version = self.api_version. end

now it take api_version parama from produer init, and using message format with timestamp. not sure of other unctionality in this case

DG-Wangtao commented 1 year ago

@doujiang24 Hi, I fixed a same issue in #160, but a new version needs to be released.

doujiang24 commented 1 year ago

@junchuLF could you please try the 0.23 release? thanks~

petruxa77799 commented 3 months ago

Sorry, but is there any update on this? Timestamp is still -1.

DG-Wangtao commented 2 months ago

@petruxa77799 Hi, which version is using in your code ?

I have two suggestions here:

  1. check version in your .rockespec: "lua-resty-kafka >= 0.23"
  2. set default version in your lua code:
    local kafka_producer = require "resty.kafka.producer"
    local producer_config = {
    ... ...
    api_version = 2,
    }
    return kafka_producer:new(broker_list, producer_config, cluster_name)
bfyxzls commented 2 months ago

方法2中

local kafka_producer = require "resty.kafka.producer"
local producer_config = {
  ... ...
  api_version = 2,
}
return kafka_producer:new(broker_list, producer_config, cluster_name)

这个代码还是没有解决,我的lua-resty-kafka是0.22的版本 方法1,因为我是apisix的helm方式,不知道怎么升级这个resty.kafka.producer

DG-Wangtao commented 2 months ago

apisix has already upgrade lua-resty-kafka here Update lua-resty-kafka to 0.23-0, but a new version is needed to be released.

You can ask apisix community to release a new version.