rocky
rocky

Reputation: 831

How to use dynamic expression in camel poll enricher

I have below scenario using pollEnrich and Aggregator.

 private static final String SOURCE_FILE_COMPONENT = "file:%s?fileName=$simple{exchangeProperty.fileName}.%s";

  from("direct:signatureVerificationRoute")
         .pollEnrich(String.format(SOURCE_FILE_COMPONENT, sourceLocation,signatureAlgorithm), new Aggregator())
         .to("direct:test");

Where in above code, i have framed dynamic uri for pollEnrich which is not working.

Upvotes: 0

Views: 617

Answers (1)

pcoates
pcoates

Reputation: 2307

You could use the overloaded pollEnrich which takes an Expression. Although you need to supply a timeout and the aggregation strategy as a bean ref, so it may not suit. If you supply null as the aggregation strategy ref it just uses the last messages, so the content of the file.

from("direct:signatureVerificationRoute")
        .pollEnrich(simple(String.format(SOURCE_FILE_COMPONENT, sourceLocation,signatureAlgorithm)), 2000, null, false)
        .to("direct:test");

Upvotes: 1

Related Questions