-
1. Re: Adding camel module to switchyard
kcbabo Mar 24, 2014 1:53 PM (in response to kbjorndahl)1 of 1 people found this helpfulYou have flatpack in your module definition but not the camel-flatpack component. You can include both jars in the same module definition (two resource definitions) or split them into two modules and add a dependency on the flatpack module from the camel-flatpack module.
-
2. Re: Adding camel module to switchyard
kbjorndahl Mar 24, 2014 2:33 PM (in response to kcbabo)Thanks Keith.
So, this is about day 3 for me looking at SwitchYard (after becoming quite familiar with JBoss ESB), so I apologize if I'm a little slow here.
Both jars you say :-) So, the first Jar is the flatpack-3.2.0.jar file I downloaded from the Camel site. What is this second .jar file you speak of, and where do I find it? Is it a switchyard specific .jar file, or does it come from the camel project?
Thanks in advance,
Keith Bjorndahl
-
3. Re: Adding camel module to switchyard
kcbabo Mar 24, 2014 2:41 PM (in response to kbjorndahl)There are two layers to this onion:
- Flatpack is a standalone Java library for parsing structured data in files. http://flatpack.sourceforge.net/
- Camel Flatpack is a Camel component which wraps Flatpack so it can be used within Camel. http://camel.apache.org/flatpack.html
To use flatpack inside of Camel, you need (1) and (2). Since Camel has not had a 3.2 release and Flatpack has, I would wager you have the Flatpack jar right now. You could do a jar listing on the archive to confirm which classes are inside. The Camel distro should have the camel-flatpack component in it, but you can also grab it directly from Maven:
http://search.maven.org/#artifactdetails%7Corg.apache.camel%7Ccamel-flatpack%7C2.10.3%7Cbundle
hth,
keith
-
4. Re: Adding camel module to switchyard
kbjorndahl Mar 24, 2014 8:19 PM (in response to kcbabo)That indeed took care of the problem.
If I may impose on you for one more detail, on the off chance that you've at some point used Flatpack within SwitchYard.
I assume my service will have something similar to:
<from uri="switchyard://SomeServiceInterface" />
<to uri="flatpack:fixed:some.pzmap.xml" />
Assuming that the .to flatpack call does indeed split my file full of records into individual messages....how do I actually do anything with them? The documentation states that I should get back an org.apache.camel.component.flatpack.DataSetList object, but when I add an additional
<to uri="switchyard://SomeOtherService..." /> all that service seems to receive is the original input file as a String. I was kind of expecting a DataSetList. Or is adding another <to uri=... /> after the flatpack call incorrect?
-
5. Re: Adding camel module to switchyard
kbjorndahl Mar 25, 2014 3:25 PM (in response to kbjorndahl)1 of 1 people found this helpfulFor anyone else who comes looking:
It appears that you can't use the Camel (XML) implemtation but must use the Camel (Java) one, in order to be able to custom build the RouteBuilder configure() method (as shown in the Flatpack Camel documentation):
public void configure() {
FlatpackDataFormat fp=new FlatpackDataFormat();
fp.setDefinition("some.pzmap.xml");
fp.setFixed(true);
from("switchyard://SomeServiceInterface")
.unmarshal(fp)
.to("switchyard://SomeOtherService");
THIS then sends a DataSetList object to SomeOtherService to be iterated through.