This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.18.x by this push:
new fbbdc6a6f17 Java DSL with pollEnrich should have timeout that accepts
property placeholder
fbbdc6a6f17 is described below
commit fbbdc6a6f177c8d0536f68fb6442810040fbded4
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Sep 6 18:26:27 2022 +0200
Java DSL with pollEnrich should have timeout that accepts property
placeholder
---
.../org/apache/camel/model/PollEnrichDefinition.java | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git
a/core/camel-core-model/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
b/core/camel-core-model/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
index 3c06c0a7c04..eb99989eae9 100644
---
a/core/camel-core-model/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
+++
b/core/camel-core-model/src/main/java/org/apache/camel/model/PollEnrichDefinition.java
@@ -107,6 +107,26 @@ public class PollEnrichDefinition extends ExpressionNode
implements AggregationS
return this;
}
+ /**
+ * Timeout in millis when polling from the external service.
+ * <p/>
+ * The timeout has influence about the poll enrich behavior. It basically
operations in three different modes:
+ * <ul>
+ * <li>negative value - Waits until a message is available and then
returns it. Warning that this method could block
+ * indefinitely if no messages are available.</li>
+ * <li>0 - Attempts to receive a message exchange immediately without
waiting and returning <tt>null</tt> if a
+ * message exchange is not available yet.</li>
+ * <li>positive value - Attempts to receive a message exchange, waiting up
to the given timeout to expire if a
+ * message is not yet available. Returns <tt>null</tt> if timed out</li>
+ * </ul>
+ * The default value is -1 and therefore the method could block
indefinitely, and therefore its recommended to use a
+ * timeout value
+ */
+ public PollEnrichDefinition timeout(String timeout) {
+ setTimeout(timeout);
+ return this;
+ }
+
/**
* Sets the 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.