Brahim T.
Brahim T.

Reputation: 5

camel write to file a list of String

how can write a liste of line into a file in Apache Camel ?

  1. first, i get a resultSet with a proc <to id="getdata" uri="sql-stored:{{sql.comptes}}?dataSource=dataSource" />
  2. passing this resultSet to create a list of String <to uri="bean:Converter" />
  3. passing this List of String to the file componnet to write in a file <to id="fileWriter" uri="file:{{data.out}}?fileName=Comptes-${date:now:yyyyMMdd'T'HHmmss'T'SSS}.txt" />

no file is created.

Upvotes: 0

Views: 1884

Answers (1)

Vyacheslav Enis
Vyacheslav Enis

Reputation: 1661

The file endpoint expects exchange body to be something that can be serialized to the byte array. If you need a list of strings (like one line per string) in the file you need to convert exchange body from list of strings to just string for example (by concatinating strings with newline char).

Upvotes: 1

Related Questions