-
1. Re: Using Camel velocity
trohovsky May 9, 2014 2:17 PM (in response to magick93)Hi Anton,
you have to add the Camel Velocity dependency to the SwitchYard, because it is not packaged by default. How to do that: Extensions - SwitchYard - Project Documentation Editor
You let your route as it is: <to uri="switchyard://OutputTemplate"/>. The reference named OutputTemplate should contain Camel URI binding with appropriate configuration (velocity:com/acme/MyResponse.vm")
Tomas
-
2. Re: Using Camel velocity
magick93 May 9, 2014 3:04 PM (in response to trohovsky)Thanks Tomas
A few questions:
- I had read the above link and that appears to be for when running in the application server. Is it also needed for when running unit tests from eclipse?
- In eclipse, I was not able to add the SY runtime to the SY project configuration, so I assume that adding the SY extension to the EAP modules would not make any difference. The drop down list where I should be able to select the SY runtime was always empty, even though I had setup a SY runtime in eclipse.
- Once I have the extension added, will I be able to add it to the already existing camel xml route? Or do I need to create a new SY Camel xml route?
-
3. Re: Using Camel velocity
jorgemoralespou_2 May 15, 2014 8:35 AM (in response to magick93)1 of 1 people found this helpfulAnton Hughes escribió:
Thanks Tomas
A few questions:
- I had read the above link and that appears to be for when running in the application server. Is it also needed for when running unit tests from eclipse?
- In eclipse, I was not able to add the SY runtime to the SY project configuration, so I assume that adding the SY extension to the EAP modules would not make any difference. The drop down list where I should be able to select the SY runtime was always empty, even though I had setup a SY runtime in eclipse.
- Once I have the extension added, will I be able to add it to the already existing camel xml route? Or do I need to create a new SY Camel xml route?
Hi,
To have a complete working example you can refer to (fsw-demo/switchyard-stringtemplate/stringtemplate-example at master · jorgemoralespou/fsw-demo · GitHub) which is the exact thing that you want but using stringtemplate component.
1. Yes, extensions need to be registered only for running server. (In my project you can see a JUnit without extension being registered, only dependencies for maven are set)
2. No worry about this, as runtime is only (AFAIK) for setting swithyard version in pom, and for running container (start/stop). Extension will not have any effect on eclipse.
3. You can add it to any route that will run in that container (JBossAS). The extension is availabe to every composite, and every component.
Cheers,
-
4. Re: Using Camel velocity
magick93 May 21, 2014 4:30 PM (in response to jorgemoralespou_2)Thanks Jorge, thats really helpful.
I have one question. I cannot see in any of your poms where you add the dependency for the string-template. How/where does SY get this camel component? Or is it already part of SY?
-
5. Re: Using Camel velocity
tcunning May 22, 2014 10:46 AM (in response to magick93)Anton,
Jorge could explain what he's doing better, but I think what we don't see in his example is him adding camel-stringtemplate to the extensions (https://docs.jboss.org/author/display/SWITCHYARD/Extensions - see the "Registering the Extension Module" part).
--Tom
-
6. Re: Using Camel velocity
jorgemoralespou_2 May 28, 2014 6:11 AM (in response to magick93)Hi Anton, Tom,
Thanks for your comments. Since this post was started, the project has changed slightly, as this project is used to demonstrate a BUG in the product that we are facing. Coming back to your question, there are 2 parts here:
- Adding the dependency to the pom, for the JUnit to work:
<dependency> <groupId>com.example.switchyard.stringtemplate</groupId> <artifactId>stringtemplate-common</artifactId> <version>0.0.1-SNAPSHOT</version> <scope>provided</scope> </dependency>
- Adding the dependency to the runtime, thus installing the extension. As Tom said, instructions are there on how to add the extension, and the extension configuration is in the README of the project:
<module xmlns="urn:jboss:module:1.0" name="org.apache.camel.stringtemplate"> <resources> <resource-root path="camel-stringtemplate-2.10.0.redhat-60024.jar"/> <resource-root path="stringtemplate-3.2.1.jar"/> </resources> <dependencies> <module name="org.slf4j"/> <module name="javax.api"/> <module name="org.apache.camel.core"/> <module name="org.antlr"/> </dependencies> </module>
So all you need to do is:
- Create the folder $JBOSS_HOME/modules/system/layers/soa/org/apache/camel/stringtemplate/main
- Copy the extract from above as module.xml
- Copy the jars that are there referred
- Modify standalone.xml to add the dependency:
<subsystem xmlns="urn:jboss:domain:switchyard:1.0"> <security-configs/> <modules> ... </modules> <extensions> ... <extension identifier="org.apache.camel.stringtemplate"/> </extensions> </subsystem>
Cheers,