Using apache camel csv processor with pollEnrich pattern?

Viewed 1133

Apache Camel 2.12.1

Is it possible to use the Camel CSV component with a pollEnrich? Every example I see is like:

from("file:somefile.csv").marshal...

Whereas I'm using the pollEnrich, like:

pollEnrich("file:somefile.csv", new CSVAggregator())

So within CSVAggregator I have no csv...I just have a file, which I have to do csv processing myself. So is there a way of hooking up the marshalling to the enrich bit somehow...?

EDIT

To make this more general... eg:

from("direct:start")
.to("http:www.blah")
.enrich("file:someFile.csv", new CSVAggregationStrategy) <--how can I call marshal() on this?

...

public class CSVAggregator implements AggregationStrategy {
@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { 
/*  Here I have:
oldExchange = results of http blah endpoint
newExchange = the someFile.csv GenericFile object */

}

Is there any way I can avoid this and use marshal().csv sort of call on the route itself?

Thanks,

Mr Tea

2 Answers
Related