wso2esb - How to return other datatypes while writing Custom class mediator in wso2 esb -
write have situation. writing custom mediator implements mediate function returns boolean. instead want return other datatype well. trying achieve thsi writing custom code add 2 numbers , return result. not able figure out, how can return integer instead of boolean. please provide me example related situation. have written code inside custom class mediator as:
public boolean mediate(messagecontext messagecontext) { system.out.println("checkpoint1: openpublication.mediate()"); if (getchanneluri() != null && !getchanneluri().isempty()) { messagecontext.setproperty("sessionid", uuid.randomuuid().tostring()); system.out.println("checkpoint2: sessionid property set"); synapseconfig = messagecontext.getconfiguration(); system.out.println("checkpoint3: messagecontextsessionid = " + messagecontext.getproperty("sessionid")); system.out.println("checkpoint3: messageid = " + messagecontext.getmessageid()); } return false; }
now want retreive property value of "sessionid" in sequence. how this. in advance.
afaik cannot make class mediator return other boolean value. class mediator, when extending abstractmediator
class, has implement boolean mediate method; pointed out.
you may try setting properties synapse message context pass values between different mediators.
for example:
public class mymediator extends abstractmediator { private string property1 = "aproperty"; private string property2; public boolean mediate(messagecontext messagecontext) { messagecontext.setproperty("myproperty", property1); property2 = (string) messagecontext.getproperty("myproperty"); return true; }
in above example, 2 string variables end having same value "aproperty". in manner, can expose type of object synapse message context , retrieve elsewhere.
Comments
Post a Comment