More FEEL for Camunda

By
  • Blog
  • >
  • More FEEL for Camunda
TOPICS

30 Day Free Trial

Bring together legacy systems, RPA bots, microservices and more with Camunda

Sign Up for Camunda Content

Get the latest on Camunda features, events, top trends, and more.

TRENDING CONTENT

I’m happy to announce the first release of the new community extension FEEL-Scala. FEEL is a part of the DMN specification of the OMG and stands for “Friendly Enough Expression Language”. It provides a simple data model and a syntax designed for a wide audience. The new community extension implements a large feature set of FEEL and replaces the default FEEL engine of the Camunda DMN engine.

Why Another FEEL Engine?

The Camunda DMN engine includes a built-in FEEL engine which can be used for input entries of a decision table. Currently, this FEEL engine can not be used for other expressions (e.g., output entries, literal expressions) and only supports a limited set of data types and operators.

The new community extension brings a completely new FEEL engine which has the goal to fill the gaps. It supports all data types, all operators, built-in functions and can be used for input entries (i.e., unary tests) and any other expression. So it might be interesting for applications that use DMN intensively to model complex decisions and especially for decision literal expressions.

Why Scala?

Scala is a modern, object-oriented and functional JVM language with a good Java interoperability. The new FEEL engine is written in Scala because it makes it very easy to build a parser for the language (i.e., based on parser combinators). And personally, I really like Scala a lot 😉

How to Use it?

If you use an embedded Camunda BPM engine then you can add the extension as dependency to your project POM:

<dependency>
  <groupId>org.camunda.bpm.extension.feel.scala</groupId>
  <artifactId>feel-engine-plugin</artifactId>
  <version>1.0.0</version>
</dependency>

And register the process engine plugin in your configuration:

<bean id="processEngineConfiguration" class="org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration">
    <property name="processEnginePlugins">
        <list>
           <bean class="org.camunda.feel.CamundaFeelEnginePlugin" />
        </list>
    </property>
</bean>

Or, if you use a shared Camunda BPM engine (i.e., Camunda distribution) then you can download the extension plugin (feel-engine-plugin-1.0.0-complete.jar) and copy it to the library folder of your application server. Then, add the plugin to your process engine configuration (e.g., conf/bpm-platform.xml):

<process-engine>
    <plugins>
        <!-- other plugins -->    
        <plugin>
            <class>org.camunda.feel.CamundaFeelEnginePlugin</class>
        </plugin>
    </plugins> 
</process-engine>

Example

Assuming you have two input variables applicant and credit_history:

applicant: {
    maritalStatus: "M",
    monthly: {
        income: 10000,
        repayments: 2500,
        expenses: 3000
    }
}

credit_history: [ 
    {
        record_date: date("2008-03-12"),
        event: "home mortgage",
        weight: 100  
    },
    {
        record_date: date("2011-04-01"),
        event: "foreclosure warning",
        weight: 150  
    } 
]

Then, you can evaluate the following FEEL expressions using the Camunda DMN engine with the FEEL-Scala extension:

applicant.monthly.income * 12                                            // 120000

if applicant.maritalStatus in ("M","S") then "valid" else "not valid"    // "valid"

sum( [applicant.monthly.repayments, applicant.monthly.expenses] )        // 5500

sum( credit_history[record_date > date("2011-01-01")].weight )           // 150

some ch in credit_history satisfies ch.event = "bankruptcy"              // false

See the complete example on GitHub.

Additional Information

You can find more information about the FEEL engine, the integration in Camunda BPM and examples on GitHub and the Wiki.

Contribute

Contributions in the form of code, bug reports and feature ideas are very welcome and can be made directly in the feel-scala repository on GitHub.

Try All Features of Camunda

Related Content

Process blueprints can now be found on Camunda marketplace! Read on to learn how they can help you and how you can contribute.
Achieve operational superiority with the intelligent backbone of service orchestration. Learn how and why you should orchestrate your services.
Learn about how AI automation can help you and your business thrive. Get insights into how you can lower costs, scale faster, improve service and more with AI.