Hi aman,

As far as I understood you want to write the value of the property into the
registry. If so, please try with the following script mediator.

       <script language="js">
            <![CDATA[
                importPackage(Packages.org.apache.synapse.config);
                var sampleProperty = mc.getProperty('sampleProperty');
                var registryPath = "gov:sampleProperty";
                if(sampleProperty != null && sampleProperty != ''){
                var existingProperty
=mc.getConfiguration().getRegistry().getResource(registryPath);
                if(existingProperty == null){
                // Create the registry entry if no such entry exists.

mc.getConfiguration().getRegistry().newResource(registryPath, false);

mc.getConfiguration().getRegistry().updateResource(registryPath,
sampleProperty);
                } else {
                // Update the registry entry if it already exists.

mc.getConfiguration().getRegistry().updateResource(registryPath,
sampleProperty);
                }
        }
        ]]>
        </script>


On Thu, Jan 10, 2019 at 3:17 PM Aman Singh <[email protected]> wrote:

> Hi Devs,
>
> In WSO2 ESB , I am using a Class Mediator which returns me a "string" as a
> message which I store say in a Log Mediator. Is there any way possible that
> I can store this Log message in a Registry File in my EI.
>
> Sample Code:-
>
> <proxy name="StringGenerator-Execution-Proxy" startOnLoad="true"
> transports="http https" xmlns="http://ws.apache.org/ns/synapse";>
>     <target>
>         <inSequence>
>            <class description="String-Generator"
> name="com.rocky.StringGenerator"/>
>             <log description="String-Display-Log" level="custom">
>                 <property expression="get-property('sampleProperty')"
> name="String-Generation-from-Java-Class"/>
>             </log>
>             <respond/>
>         </inSequence>
>         <outSequence/>
>         <faultSequence/>
>     </target>
> </proxy>
>
> I want to Store the message inside "sampleProperty" in a Registry in EI.
> Help would be really appreciated.
>
> Thank you,
> Aman
>


-- 
Shakila Sasikaran
Software Engineer
Mobile :+94 (0) 77 526 6848
[email protected]
WSO2, Inc.
lean . enterprise . middleware
http://www.wso2.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to