Hi !
I would like to know if someone has already found a clean solution to this
point.
I have a directory with CSV file with :
A;1
B;2
...
The bind is like :
@CsvRecord(separator = ";" )
public class BindFileCSV {
@DataField(pos = 1)
public String COL1;
@DataField(pos = 2 )
public String COL2;
}
Classic...
i would like to bind output with differents schemas regarding to a header
value
from("file://C:/Temp/camel/rep1/?noop=true")
.routeId("ROUTE_1")
.id("ROUTE_1")
.split().tokenize("\n")
.streaming()
.unmarshal()
.bindy(BindyType.Csv, Ticket.class)
.choice()
.when( header("PROP").isEqualTo("1"))
.marshal()
.bindy(BindyType.Csv, TicketOUT1.class)
.recipientList(simple("stream:file?fileName=C:/Temp/camel/rep1/out/yop.csv"))
.end()
.when( header("PROP").isEqualTo("2"))
.marshal()
.bindy(BindyType.Csv, TicketOUT2.class)
.recipientList(simple("stream:file?fileName=C:/Temp/camel/rep2/out/yop.csv"))
.end()
.otherwise()
.end()
.log("fin")
.end()
;
I there an elegant way of to do the conversion from Ticket to TicketOUT1 ?
Thanks !
JF