This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 850e50bb10c6 CAMEL-28014: camel-dapr: the CamelDaprTimeout header is
ignored (#31237)
850e50bb10c6 is described below
commit 850e50bb10c694a75fa7f7146ec086ce30dd5741
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed Dec 2 09:34:09 2026 +0100
CAMEL-28014: camel-dapr: the CamelDaprTimeout header is ignored (#31237)
- CAMEL-28014: camel-dapr: fix CamelDaprTimeout header being ignored
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
.../camel/component/dapr/DaprExchangeHeaders.java | 2 +-
.../dapr/operations/DaprWorkflowTest.java | 54 ++++++++++++++++++++++
2 files changed, 55 insertions(+), 1 deletion(-)
diff --git
a/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/DaprExchangeHeaders.java
b/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/DaprExchangeHeaders.java
index 913a0741e472..0090f09fcb5c 100644
---
a/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/DaprExchangeHeaders.java
+++
b/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/DaprExchangeHeaders.java
@@ -183,7 +183,7 @@ public class DaprExchangeHeaders {
}
public static Duration getTimeoutFromHeaders(final Exchange exchange) {
- return getObjectFromHeaders(exchange, DaprConstants.GET_WORKFLOW_IO,
Duration.class);
+ return getObjectFromHeaders(exchange, DaprConstants.TIMEOUT,
Duration.class);
}
public static String getEventNameFromHeaders(final Exchange exchange) {
diff --git
a/components/camel-dapr/src/test/java/org/apache/camel/component/dapr/operations/DaprWorkflowTest.java
b/components/camel-dapr/src/test/java/org/apache/camel/component/dapr/operations/DaprWorkflowTest.java
index 88670f4a152d..ace8557924e2 100644
---
a/components/camel-dapr/src/test/java/org/apache/camel/component/dapr/operations/DaprWorkflowTest.java
+++
b/components/camel-dapr/src/test/java/org/apache/camel/component/dapr/operations/DaprWorkflowTest.java
@@ -598,6 +598,60 @@ public class DaprWorkflowTest extends CamelTestSupport {
assertDoesNotThrow(() -> operation.validateConfiguration(exchange));
}
+ @Test
+ void testWaitForInstanceStartTimeoutFromHeader() throws TimeoutException {
+ // Regression test for CAMEL-28014: CamelDaprTimeout header was ignored
+ // because getTimeoutFromHeaders() read GET_WORKFLOW_IO instead of
TIMEOUT.
+ Duration headerTimeout = Duration.ofSeconds(42);
+
+ WorkflowState workflowStatus = mock(WorkflowState.class);
+ when(endpoint.getWorkflowClient()).thenReturn(client);
+ when(client.waitForWorkflowStart(anyString(), any(Duration.class),
any(Boolean.class)))
+ .thenReturn(workflowStatus);
+
+ DaprConfiguration configuration = new DaprConfiguration();
+ configuration.setOperation(DaprOperation.workflow);
+
configuration.setWorkflowOperation(WorkflowOperation.waitForInstanceStart);
+ configuration.setWorkflowInstanceId("myInstance");
+ // No timeout in configuration — it must come from the header
+ DaprConfigurationOptionsProxy configurationOptionsProxy = new
DaprConfigurationOptionsProxy(configuration);
+
+ final Exchange exchange = new DefaultExchange(context);
+ exchange.getIn().setHeader(DaprConstants.TIMEOUT, headerTimeout);
+
+ final DaprWorkflowHandler operation = new
DaprWorkflowHandler(configurationOptionsProxy, endpoint);
+ operation.handle(exchange);
+
+ verify(client).waitForWorkflowStart("myInstance", headerTimeout,
false);
+ }
+
+ @Test
+ void testWaitForInstanceCompletionTimeoutFromHeader() throws
TimeoutException {
+ // Regression test for CAMEL-28014: CamelDaprTimeout header was ignored
+ // because getTimeoutFromHeaders() read GET_WORKFLOW_IO instead of
TIMEOUT.
+ Duration headerTimeout = Duration.ofSeconds(99);
+
+ WorkflowState workflowStatus = mock(WorkflowState.class);
+ when(endpoint.getWorkflowClient()).thenReturn(client);
+ when(client.waitForWorkflowCompletion(anyString(),
any(Duration.class), any(Boolean.class)))
+ .thenReturn(workflowStatus);
+
+ DaprConfiguration configuration = new DaprConfiguration();
+ configuration.setOperation(DaprOperation.workflow);
+
configuration.setWorkflowOperation(WorkflowOperation.waitForInstanceCompletion);
+ configuration.setWorkflowInstanceId("myInstance");
+ // No timeout in configuration — it must come from the header
+ DaprConfigurationOptionsProxy configurationOptionsProxy = new
DaprConfigurationOptionsProxy(configuration);
+
+ final Exchange exchange = new DefaultExchange(context);
+ exchange.getIn().setHeader(DaprConstants.TIMEOUT, headerTimeout);
+
+ final DaprWorkflowHandler operation = new
DaprWorkflowHandler(configurationOptionsProxy, endpoint);
+ operation.handle(exchange);
+
+ verify(client).waitForWorkflowCompletion("myInstance", headerTimeout,
false);
+ }
+
public static class NotWorkflow {
public void foo() {
System.out.println("hello");