|
Flatpack has been edited by Claus Ibsen (Aug 17, 2008). Change summary: CAMEL-830 Flatpack ComponentThe Flatpack component supports fixed width and delimited file parsing via the FlatPack library URI formatflatpack:[delim|fixed]:flatPackConfig.pzmap.xml
URI Options
Message HeadersCamel will store the following headers on the IN message:
Message BodyThe component delivers the data in the IN message as a DataSetList object that has converters for Map or List. For example to get the firstname from the sample below: Map row = exchange.getIn().getBody(Map.class); String firstName = row.get("FIRSTNAME"); However you can also always get it as a List even for splitRows=true. The sample example: List data = "" Map row = (Map)data.get(0); String firstName = row.get("FIRSTNAME"); Header and Trailer recordsIn Camel 1.5 onwards the header and trailer notions in Flatpack is supported. However it is required that you must use fixed record id names:
The example below illustrates this fact that we have a header and a trailer. You can omit one or both of them if not needed. <RECORD id="header" startPosition="1" endPosition="3" indicator="HBT"> <COLUMN name="INDICATOR" length="3"/> <COLUMN name="DATE" length="8"/> </RECORD> <COLUMN name="FIRSTNAME" length="35" /> <COLUMN name="LASTNAME" length="35" /> <COLUMN name="ADDRESS" length="100" /> <COLUMN name="CITY" length="100" /> <COLUMN name="STATE" length="2" /> <COLUMN name="ZIP" length="5" /> <RECORD id="trailer" startPosition="1" endPosition="3" indicator="FBT"> <COLUMN name="INDICATOR" length="3"/> <COLUMN name="STATUS" length="7"/> </RECORD> Using the endpointA common use case is sending a file to this endpoint for further processing in a separate route. For example... <camelContext xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="file://someDirectory"/> <to uri="flatpack:foo"/> </route> <route> <from uri="flatpack:foo"/> ... </route> </camelContext> You can also convert the payload of each message created to a Map for easy Bean Integration See Also |
Unsubscribe or edit your notifications preferences
