I have a String that's delimited by ~. This string is returned from a database query. I'm able to parse it with the following code in my route:
@Override public void configure() throws Exception { CsvDataFormat csv = new CsvDataFormat(); csv.setDelimiter("~"); ... .to("bean:myStoredProcedure") .process(myJdbcProcessor) .unmarshal(csv) .process(mySearchCsvProcessor) Today, I encountered a use case where not one string would be returned, but multiple strings. To handle this, I've changed myJdbcProcessor to have the following: List<String> results = jdbcTemplate.queryForList("...", String.class); if (results.size() == 1) { exchange.getIn().setBody(results.get(0), String.class); } else { exchange.getIn().setBody(results, List.class); } When the result size is 1, everything works as expected. However, when there are multiple results, the csv unmarshal blows up with the following error: org.apache.camel.InvalidPayloadException: No body available of type: java.io.InputStream Is it possible to parse multiple lines with unmarshal(csv)? I tried the following, but that didn't work b/c it only gets the first line: exchange.getIn().setBody(StringUtils.collectionToCommaDelimitedString(results), String.class); Thanks, Matt