How to call rule function in a different rule?

Solution Verified - Updated -

Issue

I'm trying to create a function that I can call from any of my rules.
I've created a DRL file that contains

package com.package;

function String hello(String name) {
    return "Hello "+name+"!";
}

In my rule I've got
import function com.package.hello;

LOG.info( hello(" Test "));

LOG works ok as I've imported it, but when I validate in business central I get
'Only a type can be imported' as one error and 'Error importing com.package.hello'

Note that function DRL file validates fine.

Is it possible to achieve this requirement? If so, how?

Environment

  • Red Hat JBoss BRMS
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content