In WSO2 ESB registry I have a DRL file
/opt/config/rules.drl
rule ""
when
...
then
...
end
I want to use this file to fire Drools rules using a custom mediator with Kie
DroolsMediator.java
class DroolsMediator extends AbstractMediator {
public boolean mediate(MessageContext context) {
KnowledgeBuilder builder...
URL url = new URL("path/to/registry/rules.drl");
builder.add(ResourceFactory.newUrlResource(url), ResourceType.DRL);
...
}
}
I have tried to get as a property but with no success:
<property name="REGISTRY-VALUE"
expression="get-property('registry', '/opt/config/rules.drl')"/>
What approach should I take to passing registry items into custom mediators?
The problem wasn't so much with the code as it was with where I was placing resources within the WSO2 Registry.
Inside the WSO2, there are three kinds of registries:
Local Registry
Entries are stored on the local filesystem and accessed as follows:
<localEntry key="Drools" src="/path/to/rules.drl" />
These can only be accessed by the ESB on the same machine as the resource.
Configuration Registry
Entries are uploaded to the WSO2 ESB and actually stored in a database, not the filesystem. They can be accessed under the registry location /_system/config/
as follows:
<property name="Drools" expression="get-property('conf:/path/to/rules.drl')" />
Governance Registry
Entries are uploaded and stored just like in the configuration registry. They can be accessed under the registry location /_system/config/
as follows:
<property name="Drools" expression="get-property('gov:/path/to/rules.drl')" />
The primary difference between the configuration and governance registries seems to be that configuration entries should be "product-specific" whereas governance entries are "global". This isn't enforced.