|
Page Edited :
SM :
Replacing tutorial-eip-su with tutorial-camel-su
Replacing tutorial-eip-su with tutorial-camel-su has been edited by Gert Vanthienen (Mar 13, 2008). Content:First of all, you have to use the maven archetype servicemix-camel-service-unit to create add a tutorial-camel-su to your project. Check this page if you need help in running the archetype. This archetype creates a service unit module with:
Afterwards, add the new service units to the service assembly by adding the necessary <dependency/> element to the SA's pom.xml. If you want, you can also change the <name/> to get a cleaner build log. Configuring camel-context.xmlApache Camel supports configuration through XML files, but for this tutorial we are going to use the Java Domain Specific Language. Modify your camel-context.xml file to point to the package containing the RouteBuilder classes as in the example below <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
<camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
<package>org.apache.servicemix.tutorial</package>
</camelContext>
</beans>
Create your RouteBuilderNow, create your own class to implement the Camel route and add this code to it: package org.apache.servicemix.tutorial; import javax.xml.transform.dom.DOMSource; import org.apache.camel.builder.RouteBuilder; /** * Camel Router for the ServiceMix tutorial * * @version $Revision: 1.1 $ */ public class MyRouteBuilder extends RouteBuilder { public void configure() { from("jbi:service:urn:servicemix:tutorial:wiretap") .convertBodyTo(DOMSource.class) .to("jbi:endpoint:urn:servicemix:tutorial:jms:myQueue", "jbi:endpoint:urn:servicemix:tutorial:file:sender"); } } Although the code pretty much speaks for itself, let us take a deeper look at it:
Build and deployIf you use the instructions on this page to substitute for servicemix-eip on 2.6. Beginner - Exercise, you should now be able to build and deploy your SA. The build output should look something like this: [INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] Tutorial
[INFO] Tutorial :: File SU
[INFO] Tutorial :: JMS SU
[INFO] Tutorial :: Camel SU
[INFO] Tutorial :: SA
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
...
Further reading
|
Unsubscribe or edit your notifications preferences
