Thanks ( like always :) Claus ! It is right that it is a little bit unusual, I have to modify a CSV and add one new field which is the original field.
the code is : from("file://C:/Temp/camel/rep1/?noop=true") .split().tokenize("\n") .streaming() .unmarshal() .bindy(BindyType.Csv, Ticket.class) .process(new Processor() { public void process(Exchange exchange) throws Exception { Ticket ticket = (Ticket) exchange.getIn().getBody() ; BindyCsvDataFormat bindyCsvDataFormat = new BindyCsvDataFormat(Ticket.class); MyOutputStream myOutputStream =new MyOutputStream(); bindyCsvDataFormat.marshal(exchange, ticket, myOutputStream); String s = new String(myOutputStream.toByteArray()); System.out.println(s); } }) .end() .end() ; with a custom outstream which keep in memory the conversion. Thanks JF 2013/5/14 Claus Ibsen <claus.ib...@gmail.com> > From your processor you can just create the bindy data format and > invoke the marshal method. > > eg add camel-bindy to your class path, and find the BindyDataFormat > class and create a new instance, configure it, and invoke the marshal > method manually. > > Its a bit unusual to do it like that, but you can do it. > > On Tue, May 14, 2013 at 4:02 PM, Jean Francois LE BESCONT > <jflebesc...@gmail.com> wrote: > > Hey ! > > > > I would like to programmatically marshal and bind my body to do : > > > > from("file://C:/Temp/camel/rep1/?noop=true") > > .split().tokenize("\n") > > .unmarshal() > > .bindy(BindyType.Csv, Ticket.class) > > .process(new Processor() { > > public void process(Exchange exchange) throws Exception { > > Ticket ticket = (Ticket) exchange.getIn().getBody() ; > > > > // Convert from ticket to CSV which is @CsvRecord > > <String or byte[]> ticketInCSVOrignal =??? ( ticket ) > > ticket.originalVersion = ticketInCSVOrignal > > > > // modify ticket start here > > } > > }) > > [...] > > > > > > Something that will do the equivalent of : > > > > .marshal() > > .bindy(BindyType.Csv, Ticket.class) > > > > > > > > I have look typeConverter and dataformat, but I am a little bit lost > > > > Any idea ? > > > > Thanks ! > > > > Jeff > > > > -- > Claus Ibsen > ----------------- > www.camelone.org: The open source integration conference. > > Red Hat, Inc. > FuseSource is now part of Red Hat > Email: cib...@redhat.com > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen >