The endpoint uri for the external service to enrich from. You must use either
Refers to the endpoint for the external service to enrich from. You must use
Refers to an AggregationStrategy to be used to merge the reply from the external
service, into a single outgoing message. By default Camel will use the reply from
the external service as outgoing message. From Camel
2.12 onwards you can also use a POJO as the
Camel 2.12: This option can be used to
explicit declare the method name to use, when using POJOs as the
Camel 2.12: If this option is
Timeout in millis when polling from the external service. See below for important details about the timeout.
By default Camel will use the
receive. Which may block until there is a
message available. It is therefore recommended to always provide a timeout value, to make
this clear that we may wait for a message, until the timeout is hit.
If there is no data then the
newExchange in the aggregation strategy is
You can pass in a timeout value that determines which method to use:
if timeout is -1 or other negative number then
receiveis selected (Important: the
receivemethod may block if there is no message)
timeoutis 0 then
The timeout values is in millis.
pollEnrich does not access any data from
the current Exchange which
means when polling it cannot use any of the existing headers you may have set on the Exchange. For example you
cannot set a filename in the
Exchange.FILE_NAME header and use
pollEnrich to consume only that file. For that you must set the filename in the endpoint URI.
In this example we enrich the message by loading the content from the file named inbox/data.txt.
from("direct:start") .pollEnrich("file:inbox?fileName=data.txt") .to("direct:result");
And in XML DSL you do:
<route> <from uri="direct:start"/> <pollEnrich uri="file:inbox?fileName=data.txt"/> <to uri="direct:result"/> </route>
If there is no file then the message is empty. We can use a timeout to either wait (potentially forever) until a file exists, or use a timeout to wait a certain period. For example to wait up to 5 seconds you can do:
<route> <from uri="direct:start"/> <pollEnrich uri="file:inbox?fileName=data.txt" timeout="5000"/> <to uri="direct:result"/> </route>