...
Code Block |
---|
<route> <from uri="direct:start"/> <pollEnrich timeout="3000"> <constant>file:inbox?fileName=data.txt"</constant> </pollEnrich> <to uri="direct:result"/> </route> |
Dynamic URI with pollEnrich
Both the enrich()
and pollEnrich()
methods support the use of dynamic URIs. The value of this type of URI is computed based on information from the current exchange. As an illustration, to poll enrich from an endpoint that uses a header to indicate a SEDA queue name, you can do something like this:
Code Block |
---|
from("direct:start")
.pollEnrich().simple("seda:${header.name}")
.to("direct:result"); |
Or, shown here in XML DSL:
Code Block |
---|
<route>
<from uri="direct:start"/>
<pollEnrich>
<simple>seda${header.name}</simple>
</pollEnrich>
<to uri="direct:result"/>
</route> |
pollEnrich Options
Name | Default Value | Description |
---|---|---|
expression | None | Specify an expression for configuring the URI of the external service to enrich from. |
uri | This options have been deprecated. Specify the | |
ref | Refers to the endpoint for the external service to enrich from. You must use either | |
strategyRef | Refers to an AggregationStrategy to be used to merge the reply from the external service into a single outgoing message. | |
StrategyMethodName | When using POJOs as the | |
strategyMethodAllowNull | false | The default behavior is that the aggregate method is not used if there is no data to enrich. |
aggregateOnException | false | The default behavior is that the aggregate method is not used if there was an exception thrown while trying to retrieve the data to enrich. |
shareUnitOfWork | false | Default behavior is that the enrich operation does not share the unit of work between the parent exchange and the resource exchange. |
cacheSize | 1000 | Option to configure the cache size for the |
ignoreInvalidEndpoint | false | Option indicates whether or not to ignore an endpoint URI that cannot be resolved |