My understanding is that the performance issues of reflection have been minimized a lot over the years. There is still a performance overhead, but I would focus on usability first and optimize performance later. If there is a real performance issue we can do some compilation style approach later to fix it.
Paul On 31 July 2013 09:50, Kasun Indrasiri <[email protected]> wrote: > We are in the process of implementing several components which involves > java sdks (twitter), although the class mediator approach works fine, it > seems to introduce some usability issues. > > - Basically, a given class mediator simply get all the required properties > from the message context where property names are hard coded in both > template and class mediator. [1] > > - One possible approach that we can use is to use POJO mediator, so that > we can dynamically resolve the incoming parameters and we could have > minimal java code when implementing our connector. > - We can even get more flexibility with spring mediator as well[2]. > - However, class mediator approach is better when it comes to performance > (since we use reflection in other two approaches). > > - We will do a PoC on these approaches and see how it goes. > > This is a sample config with POJO Mediator > eg: > > package org.apache.twitter; > > import org.apache.synapse.Command; > > public class TwitterInvokeMediator implements Command { > > private String twitterSecrect; > > private String twitterId; > > private String message; > > public void execute() { > > System.out.println("TwitterID :" + twitterId); > > twitterId = "CDE"; > > } > > > public String getTwitterSecrect() { > > return twitterSecrect; > > } > > public void setTwitterSecrect(String twitterSecrect) { > > this.twitterSecrect = twitterSecrect; > > } > > public String getTwitterId() { > > return twitterId; > > } > > public void setTwitterId(String twitterId) { > > this.twitterId = twitterId; > > } > > public String getMessage() { > > return message; > > } > > public void setMessage(String message) { > > this.message = message; > > } > > } > > > Invocation : > > > <pojoCommand name="org.apache.twitter.TwitterInvokeMediator"> > > <axis2ns1:property xmlns:axis2ns1=" > http://ws.apache.org/ns/synapse" > > name="twitterId" > > expression="$ctx:TWID" > > action="ReadMessage"/> > > <axis2ns1:property xmlns:axis2ns1=" > http://ws.apache.org/ns/synapse" > > name="twitterId" > > context-name="updatedID" > > > action="UpdateContext"/> > > </pojoCommand> > > > > [1] > https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.1.0/components/mediation/mediation-library/connectors/org.wso2.carbon.mediation.library.connectors.twitter/4.1.0/src/main/java/org/wso2/carbon/mediation/library/connectors/twitter/TwitterUpdateStatusMediator.java > > [2] > https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.1.0/dependencies/synapse/2.1.1-wso2v3/modules/samples/src/main/java/samples/mediators/extensions/SpringCustomLogger.java > -- > Kasun Indrasiri > Software Architect > WSO2, Inc.; http://wso2.com > lean.enterprise.middleware > > cell: +94 71 536 4128 > Blog : http://kasunpanorama.blogspot.com/ > > _______________________________________________ > Architecture mailing list > [email protected] > https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture > > -- Paul Fremantle CTO and Co-Founder, WSO2 OASIS WS-RX TC Co-chair, Apache Member UK: +44 207 096 0336 US: +1 646 595 7614 blog: http://pzf.fremantle.org twitter.com/pzfreo [email protected] wso2.com Lean Enterprise Middleware Disclaimer: This communication may contain privileged or other confidential information and is intended exclusively for the addressee/s. If you are not the intended recipient/s, or believe that you may have received this communication in error, please reply to the sender indicating that fact and delete the copy you received and in addition, you should not print, copy, retransmit, disseminate, or otherwise use the information contained in this communication. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions.
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
