Re: Using Class mediator

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Using Class mediator

Lahiru Madushanka-2
Hi Aman,

You can add the resulting string to the message context as a property
@Override
public boolean mediate(MessageContext messageContext) {
String result = "This is the resulting String";
messageContext.setProperty("sampleProperty",result);
return true;
Then, inside the proxy/API we can read that property as below

<?xml version="1.0" encoding="UTF-8"?>
       name="testClass"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <class name="mediator.TestMediator"/>
         <log>
            <property expression="get-property('sampleProperty')" name="Property_from_class"/>
         </log>
         <drop/>
      </inSequence>
   </target>
   <description/>
</proxy>

Thanks,
Lahiru

On Wed, Aug 8, 2018 at 5:20 PM Aman Singh <[hidden email]> wrote:
Dear Lahiru,

I have created a custom JAVA class, which produces a "string" as output on running that class.  In my WSO2 ESB, I am calling that class with help of Class Mediator.

Can you please tell me how can I store the value returned by my JAVA class in say a LOG mediator or Property mediator or anything?

Your help would be very much appreciated.

Thank you,
Aman.

_______________________________________________
Dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/dev