I would like to send string which presents column name and after there is sql to get data then send all on csv. My goal is to have column header on csv.
I know that there is camel csv option to output column header but any of option worked for me so i try to send string before the data written on CSV.
I would like to know if i can send String to camel csv ? if yes, could you please advise me how ?
XML
<to uri="bean:testImpl?method=columnHeader()" />
<to uri="sql:{{order.query}}?dataSource=orderDataSource" />
<marshal>
<csv delimiter=";" />
</marshal>
Java testImpl.class
public String columnHeader() {
return "header1;header2;header3;header4;header5;header6;header7";
}
I tried like this but the programe doesn't recognize the method columnHeader in testImpl.class
error : org.apache.camel.component.bean.MethodNotFoundException: Method with name: columnHeader() not found on bean
Thank you for you help
Is your Java class really a Camel (or Spring) Bean? For the use of Beans in a Camel Route, they must be registered Beans in the Context.
In Spring this can be achieved with the @Component
annotation or by configuring the Bean with Java or XML.