Is there any way to create custom functions for FEEL expressions that work with both the DMN Engine’s FEEL Scala Engine and the standalone FEEL Scala Engine?
We use both of these engines in our Java solution, and would like to register our custom functions with both the DMN Engine and the standalone FEEL Scala Engine. When registering a custom function with DMN, you must create an implementation of
FeelCustomFunctionProvider. However, when attempting to do the same with the standalone FEEL Scala Engine, you must create an implementation of
These two use cases are extremely similar, but not identical, meaning I will potentially need to create two copies of each custom function I want our FEEL expressions to support.
that is an interesting use case!
I think the short answer is no. As you mentioned, the interfaces are slightly different (see also https://docs.camunda.org/manual/develop/user-guide/dmn-engine/feel/custom-functions/).
I would recommend extracting the core logic into a class that is used by both plugin mechanics.
Maybe, there is also a way to wrap one mechanic into the other but I’m not sure.
FYI: @tasso94 any idea?
Hi @Alex_Solorio ,
As Philipp already mentioned, a unified custom function mechanism is not available for both the Camunda BPM DMN Engine as well as for the standalone FEEL Engine.
Here is why:
The FEEL Engine is based on Scala, and it’s custom function mechanism expects and returns types that are highly dependent on Scala native types. Handling Scala native types is handy when you write your custom functions in Scala code but becomes a tedious task in a Java-only project. The Camunda BPM DMN Engine offers a custom function mechanism based on Java native types.
I would join the solution Philipp outlined.