Taken from Claus's Camel Book, I highly recommend the purchase, you can get hard copy and soft pdf.
PollEnrich uses a polling consumer to retrieve messages, and it offers three timeout modes: ■ pollEnrich(timeout = -1)-Polls the message and waits until a message arrives. This mode will block until a message exists. ■ pollEnrich(timeout = 0)-Immediately polls the message if any exists; otherwise null is returned. It will never wait for messages to arrive, so this mode will never block. This is the default mode. ■ pollEnrich(timeout > 0)-Polls the message, and if no message exists, it will wait for one, waiting at most until the timeout triggers. This mode will potentially block. It's a best practice to either use timeout = 0 or to assign a timeout value when using pollEnrich to avoid waiting indefinitely if no message arrives. SEE http://camel.apache.org/content-enricher.html PollEnrich Options - below taken from above doc link 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 (Camel 2.15 or older): <route> <from uri="direct:start"/> <pollEnrich uri="file:inbox?fileName=data.txt" timeout="5000"/> <to uri="direct:result"/> </route> For example to wait up to 5 seconds you can do (Camel 2.16 or newer): <route> <from uri="direct:start"/> <pollEnrich timeout="5000"> <constant>file:inbox?fileName=data.txt</constant> </pollEnrich> <to uri="direct:result"/> </route -----Original Message----- From: erik_romson [mailto:[email protected]] Sent: Friday, January 15, 2016 10:54 AM To: [email protected] Subject: pollenrich with timeout and dynamic uri Hi all, I'm been sitting with this for some time is there a way to set the timeout when doing from("direct:start") .pollEnrich().simple("${body}") .to("direct:result"); if the body is something like file:///path/step1?fileName=file something very simple probably that I have overlooked if not, what are the workarounds? Regards -- View this message in context: https://urldefense.proofpoint.com/v2/url?u=http-3A__camel.465427.n5.nabble.com_pollenrich-2Dwith-2Dtimeout-2Dand-2Ddynamic-2Duri-2Dtp5776324.html&d=CwICAg&c=IV_clAzoPDE253xZdHuilRgztyh_RiV3wUrLrDQYWSI&r=Hb1nXb7biSqY9NYScX39HfYaeuqILlgaLYiYNWt8oJo&m=6qBmyu-YOxYvzeLwFKT35vvC2h5BxZYnLkHOKJ_J_kw&s=EzZuhzdRvTR7XdAulU0aq6HDrkjWUViEL-YaLe8TYpI&e= Sent from the Camel - Users mailing list archive at Nabble.com.
