You have different options: 1) use Bindy the Willem's way (bear in mind that if you use two data format classes you have to place them in different top-level packages) 2) use Bean-IO and do something like:
final Predicate predicateOrder = body().startsWith("01"); final Predicate predicateCustomer = body().startsWith("02"); from("file://tmp") .split(body(String.class) .tokenize("\n")).streaming() .choice() .when(predicateOrder) .unmarshal(new BeanIODataFormat("beanio-mapping.xml","order")) .to("log:ORDER?level=INFO&showHeaders=false") .when(predicateCustomer) .unmarshal(new BeanIODataFormat("beanio-mapping.xml","customer")) .to("log:CUSTOMER?level=INFO&showHeaders=false") .end(); -- lb On Fri, Jul 12, 2013 at 4:17 AM, Willem jiang <willem.ji...@gmail.com>wrote: > I think you can split the file and routing the lines to different bindy > data format base on the first 2 character. > > > -- > Willem Jiang > > Red Hat, Inc. > FuseSource is now part of Red Hat > Web: http://www.fusesource.com | http://www.redhat.com > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) > (English) > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) > Twitter: willemjiang > Weibo: 姜宁willem > > > > > > On Friday, July 12, 2013 at 2:59 AM, rodrickmusser wrote: > > > I am wondering if Bindy can be used in the following scenario: > > > > The file format I am working with is fixed length. The first two > characters > > indicate the record type. For example, "01" indicates an order record, > "02" > > indicates a customer record. If the record is an order record, characters > > 2-11 are the order id. If the record is a customer record, characters > 2-20 > > is the customer name. > > > > How does Bindy handle this situation? > > > > > > > > -- > > View this message in context: > http://camel.465427.n5.nabble.com/Using-Bindy-for-multiple-record-types-in-the-same-file-tp5735541.html > > Sent from the Camel - Users mailing list archive at Nabble.com ( > http://Nabble.com). > > > >