Is scripting possible in Flowable

Hello, my name is Jaison Joseph and I am totally new to Flowables, but I am familiar to similar programming patterns. My team currently works on RedHat PAM, all the business rules are created in PAM and now planning to switch over to Flowable. So wanted to get some idea on how to start and also have few questions before that. In RedHat PAM, we have the option to write rules using the notation or we can even write rules using the programming language called drools . And most of our rules are written in that fashion. I did some read up to see if similar features are available here, if so what scripting language do we use here…? Any docoumentation towards that will be of great help… Thank you

Hey @valjaison,

In Flowable you have 2 ways of writing rules:

  • Using Drools through the Business Rule Task
  • Using the Decision Model and Notation (DMN) standard through the Decision Task which calls the Flowable DMN implementation

You also asked about scripting. Flowable has the Script Task which allows you to use any JSR-223 compatible scripting engine. In our test suite we use Javascript (through Nashorn) and Groovy.

Hope this helps,
Filip

Thank you for your response!

Hey @filiphr
Will the deprecation of Nashorn impact Flowable Script Tasks?
Per GraalVM, Nashorn has been removed from JDK 15 and deprecated in JDK 11. What are Flowable’s plans in this area?

1 Like

Hey @srallapa,

Even though Nashorn has been removed from the JDK the project is still very much alive as a standalone project GitHub - openjdk/nashorn: http://openjdk.java.net/projects/nashorn/. It is available on Maven Central and can be added as a dependency in projects using JDK 15+.

As far as I know GraalVM also has an implementation of the Java ScriptEngine, which means that it can be used as well. We are currently not testing the scripting capabilities with Graal. However, if people are interested we are more than happy to accept contributions that will add testing and / or tighter integration with GraalVM scripting.

Cheers,
Filip

Hey @filiphr
I was kicking the tires on 6.7.2 and was using a script task with script format javascript. The server threw the following error

2022-02-10 22:12:07.178 WARN 76565 — [io-8080-exec-12] o.f.e.i.b.b.ScriptTaskActivityBehavior : Exception while executing myscript : Can’t find scripting engine for ‘javascript’
2022-02-10 22:12:07.180 ERROR 76565 — [io-8080-exec-12] o.s.b.w.servlet.support.ErrorPageFilter : Forwarding to error page from request [/app/rest/process-instances] due to exception [Can’t find scripting engine for ‘javascript’]

Any suggestions on how to proceed? Should I switch to groovy?

Answering my own question…
JDK 15
downloaded Maven Central Repository Search
downloaded dependencies from Maven Central asm, asm commons, asm utilities and asm tree.
I picked 7.3.1 because that’s what the dependencies for nashorn 15.3 said