Let’s just cat to the chase. I want to create mini LUA framework(set of UDF) allowing us to run different aggregations on the aerospike. Here you may find toy project which demonstrates it. Everything works fine while I run my function using aql. But when I want to call my func from the java application using
com.aerospike.client.AerospikeClient#queryAggregate(com.aerospike.client.policy.QueryPolicy, com.aerospike.client.query.Statement) I start getting errors like
org.luaj.vm2.LuaError: demo:1 module 'person_pb' not found: person_pb. This demo app is mostly inspired by Protobuf Module Example and Implementing SQL Operations: Aggregates (Part 1, Part 2), I just combined them together. I tried different workaround to provide all the required modules but it always failes because next required module missing.
When I try to provide missing moduel(just put it near to module I am calling) it starts compaining aboud missing module protobuf. I also tried to use
com.aerospike.client.IAerospikeClient#register(com.aerospike.client.policy.Policy, java.lang.String, java.lang.String, com.aerospike.client.Language), play with
com.aerospike.client.lua.LuaConfig#SourceDirectory - nothing works to me. So, literally to get it working I need to pull all the source of lua modules from AS server to my local machine.
Could someone please take a look at the demo project and help me/explain how to get testJavaAerospikeClient test case passed? I want it to be work the same as aql version testAqlIsAbleToCallLuaFuncToConvertDecodeProtoDigestAndReturnJson.
Also, I’d appropriate if for explanation, why java client cannot make call lua module on AS side remotely and get the result. Why so much ceremony with loading/compiling lua code on the client side? Is there any way how to skip this step and ask client just call remote function and get the result?
I’ll highly appreciate for any advice in solving problem. Thanks in advance.