Saturday, March 28, 2015

Empty string returned when fetching properties stored in WSO2 ESB?

Once I encountered this scenario where I have set of properties stored in registry and I wanted to fetch them in my ESB mediation sequence.

I had set of properties stored in /_system/config/myConfig. So I used get-property function as follows in my mediation sequence to read the value of stored properties,



The problem was, get-property function was keep returning empty value.

Then I debugged to find out the issue and it turned out that registry stored in the synapse context was null.


The reason for the registry to be not loaded into the context was, I have missed following in my synapse definition,

<registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">

<parameter name="cachableDuration">15000</parameter>


When browsed to the soruce view of WSO2 ESB, I noticed that above entry is not present in the configuration and I prevents registry being loaded into the synapse context. After adding the above to the synapse definition everything started working as expected.