Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 expression option instead.

ref

Refers to the endpoint for the external service to enrich from. You must use either uri or ref.

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 AggregationStrategy, specify this option to explicitly declare the name of the aggregation method

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 ProducerCache, which caches producers for reuse in the enrich operation

ignoreInvalidEndpoint

false

Option indicates whether or not to ignore an endpoint URI that cannot be resolved