Skip to end of metadata
Go to start of metadata

In addition to the management console-based configurations discussed in previous sections, there are also configuration file-based changes specific to WSO2 BRS as follows.

Rule Engine Configuration 

Rule engine config information can be specified in <PRODUCT_HOME>\repository\conf\rule-engine-config.xml. Its default configuration is as follows.


<ruleEngineConfig xmlns="xs:string">
   <ruleEngineProvider className="xs:string">
       <property name="xs:string" value="xs:string"/>*


  • ruleEngineProvider: The "ClassName" specifies the rule service provider implementation. By default, it is org.wso2.carbon.rule.engine.jsr94.JSR94BackendRuntimeFactory. The default JSR94 API provider is the open source Drools rule engine.
  • Properties: Specify configuration information for the rule service provider. For example, for "JSR94BackendRuntimeFactory", there are two important properties : class and uri. The class is to provide the JSR 94 rule service provider and the default value for it is org.drools.jsr94.rules.RuleServiceProviderImpl. The uri is to provide the JSR 94 rule service provider URI and the default value of it is http://drools.org/. Another import property is default.properties.provider, which can be used to provide default properties to be used when creating rule execution sets and loading rule service provider.

A example rule-engine-config.xml is shown bellow.


<ruleEngineConfig xmlns="http://wso2.org/carbon/rules/conf">
    <ruleEngineProvider className="org.wso2.carbon.rule.backend.drools.DroolsBackendRuntimeFactory"/>

The above configuration provides information required to expose a rule script as a web service. There are two important parts in the services.xml of a rule service:

  • rule set definition
  • input/output facts definitions

Rule Service Configuration

When creating a rule service, you configure an .rsl file with the following elements:

       <rule resourceType="regular|dtable" sourceType="inline|registry|file|url""></rule>
    <operation name="xs:string">
        <input wrapperElementName="xs:string" namespace="xs:string">
            <fact elementName="xs:string" namespace="xs:string" type="xs:string"></fact>*
        <output wrapperElementName="xs:string" namespace="xs:string">
            <fact elementName="xs:string" namespace="xs:string" type="xs:string"></fact>*


RuleSet definition : ruleset configuration is to specify the rule script which can be in the classpath, registry, or in-lined.

Facts/Results definitions : Facts/results configuration should be specified per operation. Facts are inserted into the rule engine from the incoming message and are also used in constructing in-message of the WSDL for a rule service. Results are used to extract the results of a rule engine execution and in constructing out-message of the WSDL for a rule service.

An example of a .drl for a rule service is shown below.


        <rule resourceType="regular" sourceType="file">orderApprovalRules.drl</rule>
    <operation name="placeOrder">
        <input wrapperElementName="placeOrder" namespace="http://com.test/placeorder">
            <fact elementName="order" namespace="http://com.test/placeorder" type="samples.userguide.PlaceOrder"></fact>
        <output wrapperElementName="placeOrderRespone" namespace="http://com.test/placeorder">
            <fact elementName="orderAccept" namespace="http://com.test/placeorder" type="samples.userguide.OrderAccept"></fact>
            <fact elementName="orderReject" namespace="http://com.test/placeorder" type="samples.userguide.OrderReject"></fact>
  • No labels