On Wed, Apr 11, 2012 at 10:24 AM, Borut Bolčina <borut.bolc...@gmail.com> wrote: > Dne 11. april 2012 09:54 je Claus Ibsen <claus.ib...@gmail.com> napisal/-a: > >> On Wed, Apr 11, 2012 at 9:43 AM, Borut Bolčina <borut.bolc...@gmail.com> >> wrote: >> > Thanks for the answers and guidelines Claus. >> > >> > I looked into the ServiceMix, but the project seems so abandoned, I >> decided >> > not to use it. I read some discussions on the user and dev lists which >> gave >> > the impression that ServiceMix has no certain future. Plus, you are bound >> > to use older versions of Karaf and other frameworks. My goal is also to >> use >> > Apache Cellar as I want fail-over architecture for my routes. Also the >> > documentation for ServiceMix is not very good. >> > >> >> For SMX I was just referring to other projects that build a project on >> top of Karaf. >> Well Karaf was the ServiceMix Kernel, so you can view the SMX project >> as Karaf + SMX. >> However more work is shifted towards Karaf, and SMX itself is more >> about the project branding, >> providing OSGi bundles, JBI legacy stuff. And then cut a release once >> in a while. Unfortunately that takes >> a lot of time as SMX uses many 3rd party projects and they need to be >> aligned etc. >> >> Besides Cellar you may also want to look at Fuse Fabric, as that is >> also for clustering, fai-over, HA stuff >> http://fabric.fusesource.org/ >> https://github.com/fusesource/fuse >> >> A new 1.2 release of Fuse Fabric is expected in the near future. >> >> Fuse Fabric plays a big role in the new line of Fuse products, which >> was announced yesterday. >> >> http://rajdavies.blogspot.se/2012/04/beta-release-of-fusesource-enteprise.html >> >> > OK, will dig into it. > > >> And for AMQ users it will make their lives much easier when setting up >> a network of brokers, clusters, HA etc. >> http://www.nighttale.net/activemq/activemq-in-cloud.html >> >> >> > One thing, is "Preparing Karaf for Camel" at >> > http://camel.apache.org/karaf.html a necessary step - I mean putting >> > modified config.properties in Karaf etc folder? >> > >> >> No I updated the docs as newer release of Karaf has a config file out >> of the box. You only need this if you use CXF and possible if you use >> camel-jaxb. >> https://cwiki.apache.org/confluence/display/CAMEL/Karaf >> >> > With freshly installed Karaf 2.2.6 and replaced config.properties I get: > > C:\Users\borutb\workarea>karaf > karaf.bat: Ignoring predefined value for KARAF_HOME > Could not create framework: java.lang.IllegalArgumentException: Property > karaf.framework must be set in the etc/config > configuration file > java.lang.IllegalArgumentException: Property karaf.framework must be set in > the etc/config.properties configuration fi > at org.apache.karaf.main.Main.createClassLoader(Main.java:998) > at org.apache.karaf.main.Main.launch(Main.java:239) > at org.apache.karaf.main.Main.main(Main.java:429) > C:\Users\borutb\workarea> >
It should not be the config.properties AFAIR. It should be the jre.properties.cxf -> jre.properties. > I am using camel-jaxb, so what am I to do? > > >> >> > I hope I will find the time today to try running some routes in the >> Karaf. >> > >> >> Btw instead of using a custom OSGi activator, you can just use a small >> piece of XML to kick-start Camel. >> For example a little OSGi blueprint XML file. >> And then from the XML file refer to your Java Camel route; eg you dont >> need to use XML routes with Camel. >> > > So much to learn. I am thinking of having very fine grained services, so > each bundle will contain one to three Camel routes and then "joined" > together into features. > > So this small blueprint instantiates Camel context and contains a reference > to my route(s) in the bundle? I only find examples of blueprints with > already defined routes like: > > <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> > > <camelContext xmlns="http://camel.apache.org/schema/blueprint"> > <route> > <from uri="timer:test" /> > <to uri="log:test" /> > </route> > </camelContext> > </blueprint> > > > How would my blueprint look like if I have routes in Java and where do I > put the blueprint file? What is the advantage of using the blueprint file > instead of osgi activator? Can't find anything about this topic in the > Camel book. > Christian Schneider wrote a little blog about Camel and Karaf and blueprint http://www.liquid-reality.de/display/liquid/2012/01/03/Karaf+Tutorial+Part+5+-+Running+Apache+Camel+integrations+in+OSGi He mentioned he wanted to donate this to the official Camel documentation. But so far nothing. So I refer to his blog. It has a link to a blueprint.xml file. Which refers to Java routes, which are defined as <bean>. The blueprint.xml file is then placed in the META-INF/blueprint directory. The standard place for that. Then Karaf + Camel takes care of handling the lifcycle and Camel knows its running in OSGi, and its using the Blueprint CamelContext and so forth. And in Camel 2.10 you can unit test blueprint outside Karaf http://davsclaus.blogspot.se/2012/01/unit-testing-osgi-blueprint-with-apache.html > Cheers, > Borut > > >> >> >> > Thanks, >> > borut >> > >> > Dne 11. april 2012 09:05 je Claus Ibsen <claus.ib...@gmail.com> >> napisal/-a: >> > >> >> On Wed, Apr 11, 2012 at 8:32 AM, Borut Bolčina <borut.bolc...@gmail.com >> > >> >> wrote: >> >> > So instead of >> >> > >> >> > <dependency> >> >> > <groupId>org.apache.camel</groupId> >> >> > <artifactId>camel-core</artifactId> >> >> > <version>${camel-version}</version> >> >> > </dependency> >> >> > >> >> > I use camel-core-osgi and use the OsgiDefaultCamelContext instead and >> I >> >> > should be safe? >> >> > >> >> > public void start(BundleContext context) throws Exception { >> >> > camelContext = new OsgiDefaultCamelContext(context); >> >> > ... >> >> > } >> >> > >> >> >> >> Yeah try that. >> >> >> >> > Will this enable me to use Camel commands in Karaf or will I have to >> use >> >> > osgi:start command? >> >> > >> >> >> >> You need to install the Camel Karaf commands, they come out of the box >> >> if you install the camel feature. >> >> >> >> In Karaf 2.2.6 onwards its even easier to install Camel as you dont >> >> have to remember a mvn url, as there is a new chooseurl command. >> >> The name of that command IMHO could have been better, as now you have >> >> features:addUrl and features:chooseUrl, and they kinda does the same. >> >> >> >> Anyway its something a like: >> >> >> >> features:chooseurl camel 2.9.1 >> >> features:install camel >> >> >> >> See details here >> >> http://camel.apache.org/karaf.html >> >> >> >> >> >> if you use CXF in Karaf then there is a jre properties file you need >> >> to replace. We put details in the Camel release notes in the bottom >> >> http://camel.apache.org/camel-290-release.html >> >> >> >> The configuration files are in the etc directory. >> >> >> >> >> >> A distribution like Apache ServiceMix got all the pre-setup out of the >> >> box, as it include CXF, Camel, ActiveMQ, Karaf out of the box. >> >> With a pure Karaf distribution you may have to tweak it. As Karaf is a >> >> general purpose container. That can be used to build/brand as other >> >> products. >> >> >> >> >> >> >> >> > Thanks, >> >> > borut >> >> > >> >> > >> >> > Dne 11. april 2012 05:51 je Claus Ibsen <claus.ib...@gmail.com> >> >> napisal/-a: >> >> > >> >> >> Hi >> >> >> >> >> >> Yeah that is how this can be done with OSGi APIs. >> >> >> >> >> >> You may want to use the camel-core-osgi JAR and use the >> >> >> OsgiDefaultCamelContext as the CamelContext instance. >> >> >> That one knows about the OSGi runtime. Otherwise you may run in >> trouble. >> >> >> >> >> >> >> >> >> On Tue, Apr 10, 2012 at 3:02 PM, Borut Bolčina < >> borut.bolc...@gmail.com >> >> > >> >> >> wrote: >> >> >> > Hello, >> >> >> > >> >> >> > I was wondering if I am going down the right path. My goal is to >> >> deploy a >> >> >> > simple Camel route to an OSGI container, but without the Spring >> >> "startup >> >> >> > code". >> >> >> > >> >> >> > The route: >> >> >> > >> >> >> > public class WeatherCurrentRouteBuilder extends RouteBuilder { >> >> >> > public void configure() { >> >> >> > ... >> >> >> > } >> >> >> > } >> >> >> > >> >> >> > and to start and stop the route I implemented: >> >> >> > >> >> >> > public class WeatherCurrentBundleActivator implements >> BundleActivator >> >> { >> >> >> > >> >> >> > CamelContext camelContext; >> >> >> > >> >> >> > public void start(BundleContext context) throws Exception { >> >> >> > camelContext = new DefaultCamelContext(); >> >> >> > >> >> >> > PropertiesComponent pc = new PropertiesComponent(); >> >> >> > pc.setLocation("classpath:weather.properties"); >> >> >> > camelContext.addComponent("properties", pc); >> >> >> > >> >> >> > camelContext.addRoutes(new WeatherCurrentRouteBuilder()); >> >> >> > >> >> >> > camelContext.start(); >> >> >> > >> >> >> > } >> >> >> > >> >> >> > public void stop(BundleContext context) throws Exception { >> >> >> > camelContext.stop(); >> >> >> > } >> >> >> > >> >> >> > } >> >> >> > >> >> >> > I added the maven-bundle-plugin into my pom to build the osgi >> bundle. >> >> >> > >> >> >> > Is this the way to go? >> >> >> > >> >> >> > Cheers, >> >> >> > borut >> >> >> >> >> >> >> >> >> >> >> >> -- >> >> >> Claus Ibsen >> >> >> ----------------- >> >> >> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com >> >> >> FuseSource >> >> >> Email: cib...@fusesource.com >> >> >> Web: http://fusesource.com >> >> >> Twitter: davsclaus, fusenews >> >> >> Blog: http://davsclaus.blogspot.com/ >> >> >> Author of Camel in Action: http://www.manning.com/ibsen/ >> >> >> >> >> >> >> >> >> >> >> -- >> >> Claus Ibsen >> >> ----------------- >> >> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com >> >> FuseSource >> >> Email: cib...@fusesource.com >> >> Web: http://fusesource.com >> >> Twitter: davsclaus, fusenews >> >> Blog: http://davsclaus.blogspot.com/ >> >> Author of Camel in Action: http://www.manning.com/ibsen/ >> >> >> >> >> >> -- >> Claus Ibsen >> ----------------- >> CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com >> FuseSource >> Email: cib...@fusesource.com >> Web: http://fusesource.com >> Twitter: davsclaus, fusenews >> Blog: http://davsclaus.blogspot.com/ >> Author of Camel in Action: http://www.manning.com/ibsen/ >> -- Claus Ibsen ----------------- CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/