I just implemented a very similar thing just yesterday. I created a HttpPollingComponent similar to the FileComponent that has HttpPollingEndpoint(s) that extend PollingEndpoint. I did run in to some tricky class loader issues, some of which I was able to figure out the cause, and some I just had to work around. (For the life of me I couldn't get it to find DefaultBootstrap even though servicemix-shared was included as a shared library in jbi.xml. This ended up being not too big of a deal since it's been deprecated anyway. I just provided my own.)
One problem I had was when I tried to add jar files to the main servicemix classpath (via <servicemix_home>/lib) or by re-packaging existing component archives to include my jars in the component classpath. I really didn't want to go that route anyway, so I didn't spend too much time trying to solve that issue. In the end, I was able to get it to work by simply including my jar in the classpath of my binding component in jbi.xml. (I did not have to include any servicemix jars in my su classpath, which you may be tempted to try.) I also had to add the xbean mapping file in the binding component classpath in order to configure my HttpPollingEndpoint in xbean.xml. At one point I noticed that it had trouble finding classes when I dropped the component into the install directory after servicemix had started, but worked fine when I restarted with it already there. I'd be interested in hearing the "correct" (or at least preferred) way to create new components by extending existing servicemix components. Eric Mickelson wrote: > > Hi, > > I would like to extend the service-file component. I successfully > created a new custom file component that extends FileComponent and has > an endpoint that extends PollingEndpoint. The dependency is specified > in the pom.xml. Unit tests work, but when creating an SU and SA and > deploying to a running servicemix I get a class not found exception: > FileComponent. > > Should I be doing this at all? Or should I create/copy some of the > file component functionality to a shared library? > > Thanks. > > -- > Eric Mickelson > > -- View this message in context: http://www.nabble.com/Best-way-to-extend-a-component-endpoint-tf3201775s12049.html#a8893222 Sent from the ServiceMix - User mailing list archive at Nabble.com.
