I am trying to create an Excel file and send it to the SFTP location using the Apache Camel. I can create a PSV from a Java object like this:
Java POJO:
@CsvRecord(separator = ",", skipFirstLine = true, generateHeaderColumns = true)
public class IexPerson implements Serializable {
private static final long serialVersionUID = 1234069326527342909L;
@DataField(pos = 1, columnName = "Person Name")
private String personName;
@DataField(pos = 2, columnName = "Gender")
private String gender;
// other fields ...
and then I convert a list of IexPersons in the route:
DataFormat iexPersonFormat = new BindyCsvDataFormat(IexPerson.class);
from("direct-get-list-of-persons")
.setHeader(Exchange.FILE_NAME).simple("Persons_${date:now:yyyyMMdd-HHmmssSSS}_${random(1000,10000000)}.csv")
.marshal(iexPersonFormat)
.to("file:///tmp?fileName=${header.CamelFileName}");
This is working fine, but now I need to create an Excel file from the same list and send it to another location. I didn't manage to get it to work. I didn't find anything on the internet that would help me.