Hi All,
I have a problem with rule mediator.
I defined input facts in rule mediator. But when im trying to callout my
java method with facts as argument i had an error like that when deploying
proxy:
ERROR - RuleMediatorFactory Can not create the rule engine
org.wso2.carbon.rule.common.exception.RuleConfigurationException: Error
during creating rule set: Rule Compilation error : [Rule name='test rule']
com/example/rule/Rule_test_rule1466459032.java (13:83) : Unknown variable or
type "Kwota_Inwestycji"
com/example/rule/Rule_test_rule1466459032.java (13:97) : Unknown
variable
or type "Rate_Up_Front"
com/example/rule/Rule_test_rule1466459032.java (13:112) : Unknown
variable
or type "Assumed_Return"
com/example/rule/Rule_test_rule1466459032.java (13:127) : Unknown
variable
or type "Czasokres_MTHS"
com/example/rule/Rule_test_rule1466459032.java (13:147) : Unknown
variable
or type "Rate_Redemption_Fee"
com/example/rule/Rule_test_rule1466459032.java (13:160) : Unknown
variable
or type "Rate_mgm_Fee"
com/example/rule/Rule_test_rule1466459032.java (13:176) : Unknown
variable
or type "Rate_Cost_Other"
com/example/rule/Rule_test_rule1466459032.java (13:193) : Unknown
variable
or type "Rate_Distributor"
com/example/rule/Rule_test_rule1466459032.java (13:210) : Unknown
variable
or type "Rate_Success_Fee"
com/example/rule/Rule_test_rule1466459032.java (13:224) : Unknown
variable
or type "Czasokres_YRS"
...
I tried to define variable types like this in rule :
<brs:rule resourceType="regular"
sourceType="inline">
package com.example.rule
//list imports here
import com.mifdi.MIFDI;
//declare any global variables here
rule "test rule"
when
Kwota_Inwestycji: Double()
Rate_Up_Front: Double()
Assumed_Return: Double()
Czasokres_MTHS: Double()
Rate_Redemption_Fee: Double()
Rate_mgm_Fee: Double()
Rate_Cost_Other: Double()
Rate_Distributor: Double()
Rate_Success_Fee: Double()
Czasokres_YRS: Double()
Calculate: String()
eval( Calculate.equals("true") )
then
update(drools.getWorkingMemory().getFactHandle(Result),);
System.out.println("----------------------" +
MIFDI.getResult(Kwota_Inwestycji,Rate_Up_Front,Assumed_Return,Czasokres_MTHS,Rate_Redemption_Fee,Rate_mgm_Fee,Rate_Cost_Other,Rate_Distributor,Rate_Success_Fee,Czasokres_YRS)
+ "------");
end
</brs:rule>
That makes no error in deploy but when i invoke proxy i got end of memory
and EI is not responding.
Java method is tested and its not a problem in here. Where should i define
variables and their types, to make it work ?
Below my proxy soruce:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="MIFIDBussinessRules"
transports="http https" startOnLoad="true" trace="disable">
<target>
<inSequence>
<property xmlns:ns0="MIDIF" name="INPUT"
expression="//ns0:Request" scope="default" type="OM"/>
<log level="full"/>
<brs:rule xmlns:brs="http://wso2.org/carbon/rules">
<brs:source>$INPUT</brs:source>
<brs:target xpath="" resultXpath=""
action="replace">$OUTPUT</brs:target>
<brs:ruleSet>
<brs:properties/>
<brs:rule resourceType="regular" sourceType="inline">
package com.example.rule
//list imports here
import com.mifdi.MIFDI;
//declare any global variables here
rule "test rule"
when
// Kwota_Inwestycji: Double()
// Rate_Up_Front: Double()
// Assumed_Return: Double()
// Czasokres_MTHS: Double()
// Rate_Redemption_Fee: Double()
// Rate_mgm_Fee: Double()
// Rate_Cost_Other: Double()
// Rate_Distributor: Double()
// Rate_Success_Fee: Double()
// Czasokres_YRS: Double()
Calculate: String()
eval( Calculate.equals("true") )
then
System.out.println("----------------------" +
MIFDI.getResult(Kwota_Inwestycji,Rate_Up_Front,Assumed_Return,Czasokres_MTHS,Rate_Redemption_Fee,Rate_mgm_Fee,Rate_Cost_Other,Rate_Distributor,Rate_Success_Fee,Czasokres_YRS)
+ "------");
end
</brs:rule>
</brs:ruleSet>
<brs:input namespace="MIDIF" wrapperElementName="facts">
<brs:fact xmlns:ns0="MIDIF" elementName="Calculate"
namespace="MIDIF" type="java.lang.String" xpath="//ns0:Calculate"/>
<brs:fact xmlns:ns0="MIDIF"
elementName="Kwota_Inwestycji" namespace="MIDIF" type="java.lang.Double"
xpath="//ns0:Kwota_Inwestycji"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Rate_Up_Front"
namespace="MIDIF" type="java.lang.Double" xpath="//ns0:Rate_Up_Front"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Assumed_Return"
namespace="MIDIF" type="java.lang.Double" xpath="//ns0:Assumed_Return"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Czasokres_MTHS"
namespace="MIDIF" type="java.lang.Double" xpath="//ns0:Czasokres_MTHS"/>
<brs:fact xmlns:ns0="MIDIF"
elementName="Rate_Redemption_Fee" namespace="MIDIF" type="java.lang.Double"
xpath="//ns0:Rate_Redemption_Fee"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Rate_mgm_Fee"
namespace="MIDIF" type="java.lang.Double" xpath="//ns0:Rate_mgm_Fee"/>
<brs:fact xmlns:ns0="MIDIF"
elementName="Rate_Cost_Other" namespace="MIDIF" type="java.lang.Double"
xpath="//ns0:Rate_Cost_Other"/>
<brs:fact xmlns:ns0="MIDIF"
elementName="Rate_Distributor" namespace="MIDIF" type="java.lang.Double"
xpath="//ns0:Rate_Distributor"/>
<brs:fact xmlns:ns0="MIDIF"
elementName="Rate_Success_Fee" namespace="MIDIF" type="java.lang.Double"
xpath="//ns0:Rate_Success_Fee"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Czasokres_YRS"
namespace="MIDIF" type="java.lang.Double" xpath="//ns0:Czasokres_YRS"/>
<brs:fact xmlns:ns0="MIDIF" elementName="Result"
namespace="MIDIF" type="java.lang.Float" xpath="//ns0:Result"/>
</brs:input>
<brs:output namespace="MIDIF" wrapperElementName="out">
<brs:fact elementName="Result" namespace="MIDIF"
type="java.lang.Float"/>
</brs:output>
</brs:rule>
<log level="full">
<property name="OUTPUT"
expression="get-property('OUTPUT')"/>
</log>
<loopback/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</target>
</proxy>
Thanks & Regards,
Melodias
--
Sent from: http://wso2-oxygen-tank.10903.n7.nabble.com/WSO2-Development-f3.html
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev