i am new in wso2 esb and define 3 service that return integer value and use filter mediator to rout from one to another , but not correct work and in filter mode always return false my source is :
<sequence xmlns="http://ws.apache.org/ns/synapse" name="SeqOne">
<log level="full"/>
<property xmlns:ns="http://org.apache.synapse/xsd" xmlns:m0="http://tempuri.org/" name="CParam" expression="//m0:SumSerViseResponse/m0:SumSerViseResult" scope="default" type="INTEGER"/>
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="CParam" expression="$ctx:CParam"/>
</log>
<property name="propertyA" value="4" scope="default" type="INTEGER"/>
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="propertyA" expression="get-property('propertyA')"/>
</log>
<property xmlns:ns="http://org.apache.synapse/xsd" name="propertyCompare" expression="$ctx:CParam > get-property('propertyA')" type="STRING"/>
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="propertyCompare" expression="get-property('propertyCompare')"/>
</log>
<filter xmlns:ns="http://org.apache.synapse/xsd" source="get-property('propertyCompare')" regex="true">
<then>
following is an example done with switch mediator,
replace the log mediators with send mediator according to your needs.
I tried your scenario and got the same output as yours. Then looked deep into it as this was a basic functionality and as I thought I've done something similar before.
The issue here is in the type of the property. For some strange reason
INTEGER
does not work here. You need to haveDOUBLE
orSTRING
. Even if you have string, it will correctly cast it when you do a comparison as in here. The following worked for me.