-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(scripting): add kotlin script (JSR-223) support #73
feat(scripting): add kotlin script (JSR-223) support #73
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing @aivinog1 🎉
Looks good. Just one commend regarding the Kotlin version.
@saig0 I've also updated the README :) |
@saig0 Hi! Can you review this, please? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @aivinog1. Looks good 🎉
The tests are running. But, when I build the JAR and run the worker then I get the following errors:
2020-11-10 07:38:04.441 WARN 27988 --- [pool-2-thread-2] io.zeebe.client.job.worker : Worker script-worker failed to handle job with key 2251799813685266 of type script, sending fail command to broker
java.lang.RuntimeException: Failed to evaluate script 'x * 2' (kotlin)
at io.zeebe.script.ScriptEvaluator.evalWithScriptEngine(ScriptEvaluator.java:60) ~[classes!/:0.8.0-SNAPSHOT]
at io.zeebe.script.ScriptEvaluator.evaluate(ScriptEvaluator.java:42) ~[classes!/:0.8.0-SNAPSHOT]
at io.zeebe.script.ScriptJobHandler.handle(ScriptJobHandler.java:59) ~[classes!/:0.8.0-SNAPSHOT]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at io.zeebe.spring.client.bean.MethodInfo.invoke(MethodInfo.java:31) ~[spring-zeebe-0.25.0.jar!/:0.25.0]
at io.zeebe.spring.client.config.processor.ZeebeWorkerPostProcessor.lambda$null$1(ZeebeWorkerPostProcessor.java:50) ~[spring-zeebe-0.25.0.jar!/:0.25.0]
at io.zeebe.client.impl.worker.JobRunnableFactory.executeJob(JobRunnableFactory.java:44) ~[zeebe-client-java-0.25.0.jar!/:0.25.0]
at io.zeebe.client.impl.worker.JobRunnableFactory.lambda$create$0(JobRunnableFactory.java:39) ~[zeebe-client-java-0.25.0.jar!/:0.25.0]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: javax.script.ScriptException: Unable to initialize repl compiler:
ERROR Unable to find extension point configuration extensions/compiler.xml (cp:
null): java.lang.IllegalStateException: Unable to find extension point configuration extensions/compiler.xml (cp:
null)
at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.asJsr223EvalResult(KotlinJsr223JvmScriptEngineBase.kt:104) ~[kotlin-compiler-embeddable-1.4.10.jar!/:1.4.10-release-411 (1.4.10)]
at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.compileAndEval(KotlinJsr223JvmScriptEngineBase.kt:63) ~[kotlin-compiler-embeddable-1.4.10.jar!/:1.4.10-release-411 (1.4.10)]
at kotlin.script.experimental.jvmhost.jsr223.KotlinJsr223ScriptEngineImpl.compileAndEval(KotlinJsr223ScriptEngineImpl.kt:94) ~[kotlin-scripting-jvm-host-1.4.10.jar!/:1.4.10-release-411 (1.4.10)]
at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.eval(KotlinJsr223JvmScriptEngineBase.kt:31) ~[kotlin-compiler-embeddable-1.4.10.jar!/:1.4.10-release-411 (1.4.10)]
at io.zeebe.script.ScriptEvaluator.eval(ScriptEvaluator.java:71) ~[classes!/:0.8.0-SNAPSHOT]
at io.zeebe.script.ScriptEvaluator.evalWithScriptEngine(ScriptEvaluator.java:56) ~[classes!/:0.8.0-SNAPSHOT]
... 16 common frames omitted
Does this work for you?
Needs to unpack kotlin-compiler dependency that contains a compiler.xml
@saig0 Oops, I've tested running a Spring Boot App via IDEA 😅. I've pushed changes that fixing it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works nicely now 🎉
Thanks @aivinog1. I'll trigger a new release for it 🚀
I've added a Kotlin Script Support (JSR-223).
Closes #72