Importing libraries/modules in custom plugins? #11484
-
Is it possible? I am in the middle of writing an ActiveMQ logger that uses the AMQP protocol and have to include the amqp-client LuaRocks module like so: ...
local http = require("resty.http")
local url = require("net.url")
local amqp = require("amqp-client")
local tostring = tostring
... I installed the module on my Apisix host with
Any ideas how I can go about solving this? |
Beta Was this translation helpful? Give feedback.
Answered by
0xdeadbeer
Aug 6, 2024
Replies: 1 comment
-
I solved it by installing the package into the tree directory of Apisix's installation - make sure the # check if amqp-client is installed
luarocks list --tree=/home/kevinj/src/apisix/deps | grep amqp-client
# no result - not installed yet
# we install it with:
luarocks --tree=/home/kevinj/src/apisix/deps install amqp-client
# check again
luarocks list --tree=/home/kevinj/src/apisix/deps | grep amqp-client
# output: amqp-client And corrected the import statement - according to the documentation of the module: ...
local http = require("resty.http")
local url = require("net.url")
local amqp = require("amqp")
local tostring = tostring
... |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
0xdeadbeer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I solved it by installing the package into the tree directory of Apisix's installation - make sure the
deps
folder exists.And corrected the import statement - according to the documentation of the module: