This is my model:
@CsvRecord(separator=",",generateHeaderColumns=true,isOrdered=true)
public class TestModel implements Serializable{
@DataField(pos=1,position=2)
String value1;
@DataField(pos=2,position=1)
String value2;
//Getters and Setters
//Constructor
}
The Bean Processor code:
public class TestProcessor {
public List<TestModel> process(){
List<TestModel> list=new ArrayList<>();
list.add(new TestModel("Value1","Value2"));
list.add(new TestModel("Value3","Value4");
return list;
}
}
The RouteBuilder code:
public class TestRouteBuilder extends RouteBuilder{
@Override
public void configure(){
BindyCsvDataFormat bindy=new BindyCsvDataFormat(com.example.TestModel.class);
from("timer:ping?period=1m").to("bean:testProcessor?method=process").marshal(bindy).to("file://C://CSV//messages?fileName=Test.csv");
}
}
If I omit the isOrdered=true attribute, the csv file gets generated.
But I want to reorder the columns in the generated csv and the csv file is not getting generated at all if the isOrdered attribute is included in the model.
Would appreciate any help on this.
Thanks.