ddelizia
ddelizia

Reputation: 1571

Camel PollEnrich not working properly

After transforming a file with xslt I have to append a file downloaded from ftp. So I did the following:

    from("direct:adobe_productList_incremental")
            .id("routeADOBESPtransformPI_productList")
            .log(LoggingLevel.INFO, "---------Starting file: ${body}")
            .convertBodyTo(InputStream.class)
            .to("xslt:classpath:" + xsltTransformationProductList)
            .log(LoggingLevel.INFO, "---------Transformed file: ${body}")
          .pollEnrich(ftpType+"://"+ftpUsername+"@"+ ftpUrl +":" + ftpPort + ftpPath_incrementalComplete +"?password="+ftpPassword+"&fileName="+ftpFilename_incrementalComplete+"&passiveMode=true&binary=true&delete=false",10000)
            .log(LoggingLevel.INFO, "---------After poll enrich: ${body}")
            .to("file:{{file.root}}{{file.outbox.products_list_incremental}}?fileName={{file.outbox.products_list_incremental.name}}.final");

untill the poll everythin works (the transformation is done correctly), but after the pollEnrich the current body is overrided by the ftp content (and not appended as it should be).

Any help?

Upvotes: 1

Views: 3779

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55540

No it works as designed.

By default the content will be overridden. If you need to append/merge or whatever, you need to use a custom aggregation strategy, and implement code logic that does this.

See the Camel docs at: http://camel.apache.org/content-enricher.html about the ExampleAggregationStrategy.

The Camel docs says

The aggregation strategy is optional. If you do not provide it Camel will by default just use the body obtained from the resource.

Upvotes: 4

Related Questions