When I use this module in Kong, I meet the following problems.
Kong docker images is kong:latest,and I install this module by "luarocks install lua-resty-kafka"
If I set kafka_conf.producer_type = "async", then I can't restart my kong. And the error is "/usr/local/share/lua/5.1/resty/timerng/init.lua:407: the timer module is not started"
init_by_lua error: /usr/local/share/lua/5.1/kong/tools/utils.lua:699: error loading module 'kong.plugins.ok-api-log.handler':
/usr/local/share/lua/5.1/resty/timerng/init.lua:407: the timer module is not started
stack traceback:
[C]: in function 'assert'
/usr/local/share/lua/5.1/resty/timerng/init.lua:407: in function 'timer_every'
/usr/local/share/lua/5.1/resty/kafka/producer.lua:350: in function 'new'
./kong/plugins/ok-api-log/handler.lua:6: in main chunk
[C]: at 0xffffbd1220c8
[C]: in function 'xpcall'
/usr/local/share/lua/5.1/kong/tools/utils.lua:690: in function 'load_module_if_exists'
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:154: in function 'load_plugin_handler'
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:260: in function 'load_plugin'
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:312: in function 'load_plugin_schemas'
/usr/local/share/lua/5.1/kong/init.lua:593: in function 'init'
init_by_lua:3: in main chunk
*If I set kafka_conf.producer_type = "sync", then I can restart my kong. But I can't send msg to kafka and the error is "API disabled in the context of log_by_lua"**
stack traceback:
[C]: in function 'old_tcp'
/usr/local/share/lua/5.1/kong/globalpatches.lua:432: in function 'tcp'
/usr/local/share/lua/5.1/resty/kafka/broker.lua:123: in function 'send_receive'
/usr/local/share/lua/5.1/resty/kafka/client.lua:182: in function '_fetch_metadata'
/usr/local/share/lua/5.1/resty/kafka/client.lua:265: in function 'fetch_metadata'
/usr/local/share/lua/5.1/resty/kafka/producer.lua:123: in function 'choose_partition'
/usr/local/share/lua/5.1/resty/kafka/producer.lua:378: in function 'send'
./kong/plugins/ok-api-log/handler.lua:105: in function <./kong/plugins/ok-api-log/handler.lua:79>
/usr/local/share/lua/5.1/kong/init.lua:374: in function 'execute_collected_plugins_iterator'
/usr/local/share/lua/5.1/kong/init.lua:1500: in function 'log'
log_by_lua(nginx-kong.conf:110):2: in main chunk while logging request,
When I use this module in Kong, I meet the following problems. Kong docker images is kong:latest,and I install this module by "luarocks install lua-resty-kafka"
If I set kafka_conf.producer_type = "async", then I can't restart my kong. And the error is "/usr/local/share/lua/5.1/resty/timerng/init.lua:407: the timer module is not started"
init_by_lua error: /usr/local/share/lua/5.1/kong/tools/utils.lua:699: error loading module 'kong.plugins.ok-api-log.handler': /usr/local/share/lua/5.1/resty/timerng/init.lua:407: the timer module is not started stack traceback: [C]: in function 'assert' /usr/local/share/lua/5.1/resty/timerng/init.lua:407: in function 'timer_every' /usr/local/share/lua/5.1/resty/kafka/producer.lua:350: in function 'new' ./kong/plugins/ok-api-log/handler.lua:6: in main chunk [C]: at 0xffffbd1220c8 [C]: in function 'xpcall' /usr/local/share/lua/5.1/kong/tools/utils.lua:690: in function 'load_module_if_exists' /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:154: in function 'load_plugin_handler' /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:260: in function 'load_plugin' /usr/local/share/lua/5.1/kong/db/dao/plugins.lua:312: in function 'load_plugin_schemas' /usr/local/share/lua/5.1/kong/init.lua:593: in function 'init' init_by_lua:3: in main chunk
*If I set kafka_conf.producer_type = "sync", then I can restart my kong. But I can't send msg to kafka and the error is "API disabled in the context of log_by_lua"** stack traceback: [C]: in function 'old_tcp' /usr/local/share/lua/5.1/kong/globalpatches.lua:432: in function 'tcp' /usr/local/share/lua/5.1/resty/kafka/broker.lua:123: in function 'send_receive' /usr/local/share/lua/5.1/resty/kafka/client.lua:182: in function '_fetch_metadata' /usr/local/share/lua/5.1/resty/kafka/client.lua:265: in function 'fetch_metadata' /usr/local/share/lua/5.1/resty/kafka/producer.lua:123: in function 'choose_partition' /usr/local/share/lua/5.1/resty/kafka/producer.lua:378: in function 'send' ./kong/plugins/ok-api-log/handler.lua:105: in function <./kong/plugins/ok-api-log/handler.lua:79> /usr/local/share/lua/5.1/kong/init.lua:374: in function 'execute_collected_plugins_iterator' /usr/local/share/lua/5.1/kong/init.lua:1500: in function 'log' log_by_lua(nginx-kong.conf:110):2: in main chunk while logging request,