Since we're on a major migration process of this website, some component documents here are out of sync right now. In the meantime you may want to look at the early version of the new website
https://camel.apache.org/staging/
We would very much like to receive any feedback on the new site, please join the discussion on the Camel user mailing list.
Flatpack DataFormatThe Flatpack component ships with the Flatpack data format that can be used to format between fixed width or delimited text messages to a
Notice: The Flatpack library does currently not support header and trailers for the marshal operation. OptionsThe data format has the following options:
UsageTo use the data format, simply instantiate an instance and invoke the marshal or unmarshal operation in the route builder: FlatpackDataFormat fp = new FlatpackDataFormat(); fp.setDefinition(new ClassPathResource("INVENTORY-Delimited.pzmap.xml")); ... from("file:order/in").unmarshal(df).to("seda:queue:neworder"); The sample above will read files from the FlatpackDataFormat df = new FlatpackDataFormat(); df.setDefinition(new ClassPathResource("PEOPLE-FixedLength.pzmap.xml")); df.setFixed(true); df.setIgnoreFirstRecord(false); from("seda:people").marshal(df).convertBodyTo(String.class).to("jms:queue:people"); In the code above we marshal the data from a Object representation as a DependenciesTo use Flatpack in your camel routes you need to add the a dependency on camel-flatpack which implements this data format. If you use maven you could just add the following to your pom.xml, substituting the version number for the latest & greatest release (see the download page for the latest versions). <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-flatpack</artifactId> <version>x.x.x</version> </dependency> |