On Thu, Nov 12, 2015 at 8:41 PM, Afkham Azeez <[email protected]> wrote:
> > > On Thu, Nov 12, 2015 at 5:05 AM, Sagara Gunathunga <[email protected]> > wrote: > >> Use case >> -------------- >> MS F/W should support at least two bean lifecycle methods so that one >> method get call during the service start-up while other one get call just >> before the service shutdown. We already have following use cases but this >> should be a much lengthy list when implementing real world use cases. >> >> 1) Service stat publishing - During the service start-up, it should be >> possible to initialize DAS agents and make connections, then during the >> service shutdown it should be possible to terminate DAS agents properly and >> close any connection remains. >> > > How are we doing the above now with the metrics component? > Initially IsuruP looked for such lifecycle extension points, but since it was not there it seems he has incorporated init logic into the constructor of the MetricsInterceptor, although it's not nice to mix separate aspect together technically it worked. Further there was no proper place to call any cleaning code during server shutdown. Thanks ! > > >> >> 2.) Metadata publishing - During the service start-up, it should be >> possible to publish service and endpoint metadata into a centralized >> metadata repository such as G-Reg and during the service shutdown it should >> be possible to remove/deactivate service or endpoint metadata on metadata >> repository. >> >> 3.) Handle connection establishment and termination for data sources such >> as RSBMS, LDAPs , legacy systems etc. >> >> >> Solution >> -------------- >> >> Instead of introducing our own proprietary approaches we could use >> @PostConstruct[1] and @PreDestroy[2] annotations available with JDK. >> Users just need to annotate their init and termination methods as follows. >> Additionally this is a natural choice for those who familiar with >> JAX-WS/JAX-RS programming models where above annotation are used for same >> purpose. >> >> @PostConstruct >> public void init() { >> LOG.info("Helloworld :: calling PostConstruct method"); >> } >> >> @PreDestroy >> public void close() { >> LOG.info("Helloworld :: calling PreDestroy method"); >> } >> >> >> I have added above 2 annotation support to MS trunk, please refer >> following working sample[3]. >> >> >> @IsuruP , since we have service lifecycle support now, we need to >> refactor your analytics sample to use proper annotations and it will become >> a real world sample as well, [3] is too simple to demonstrate real world >> use cases. >> >> >> [1] - >> https://docs.oracle.com/javaee/5/api/javax/annotation/PostConstruct.html >> [2] - >> https://docs.oracle.com/javaee/5/api/javax/annotation/PreDestroy.html >> [3] - https://github.com/wso2/product-mss/tree/master/samples/lifecycle >> >> >> Thanks ! >> -- >> Sagara Gunathunga >> >> Architect; WSO2, Inc.; http://wso2.com >> V.P Apache Web Services; http://ws.apache.org/ >> Linkedin; http://www.linkedin.com/in/ssagara >> Blog ; http://ssagara.blogspot.com >> >> > > > -- > *Afkham Azeez* > Director of Architecture; WSO2, Inc.; http://wso2.com > Member; Apache Software Foundation; http://www.apache.org/ > * <http://www.apache.org/>* > *email: **[email protected]* <[email protected]> > * cell: +94 77 3320919 <%2B94%2077%203320919>blog: * > *http://blog.afkham.org* <http://blog.afkham.org> > *twitter: **http://twitter.com/afkham_azeez* > <http://twitter.com/afkham_azeez> > *linked-in: **http://lk.linkedin.com/in/afkhamazeez > <http://lk.linkedin.com/in/afkhamazeez>* > > *Lean . Enterprise . Middleware* > -- Sagara Gunathunga Architect; WSO2, Inc.; http://wso2.com V.P Apache Web Services; http://ws.apache.org/ Linkedin; http://www.linkedin.com/in/ssagara Blog ; http://ssagara.blogspot.com
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
