You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ap...@apache.org on 2026/05/29 12:12:51 UTC

(camel) branch main updated: Replace several deprecated methods in Dapr

This is an automated email from the ASF dual-hosted git repository.

apupier 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 76902445357d Replace several deprecated methods in Dapr
76902445357d is described below

commit 76902445357dcba34bd72ade945102d8034ac792
Author: Aurélien Pupier <ap...@ibm.com>
AuthorDate: Fri May 29 13:46:24 2026 +0200

    Replace several deprecated methods in Dapr
    
    the part done consists in the renaming from WorkflowInstance* to
    Workflow*
    
    Note that it remains a part which is deprecated related to Subscription,
    they recommend now to use Topic for a more reactive model. As it will
    surely causing API break on Camel side, I separate it from this part and
    let it for later.
    
    Signed-off-by: Aurélien Pupier <ap...@ibm.com>
---
 .../dapr/operations/DaprOperationResponse.java     | 22 +++++++++++-----------
 .../dapr/operations/DaprWorkflowHandler.java       | 10 +++++-----
 .../dapr/operations/DaprWorkflowTest.java          | 20 ++++++++++----------
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/operations/DaprOperationResponse.java b/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/operations/DaprOperationResponse.java
index 3dcd6880a3f2..c627c3f9b95f 100644
--- a/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/operations/DaprOperationResponse.java
+++ b/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/operations/DaprOperationResponse.java
@@ -20,7 +20,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import io.dapr.client.domain.ConfigurationItem;
-import io.dapr.workflows.client.WorkflowInstanceStatus;
+import io.dapr.workflows.client.WorkflowState;
 import org.apache.camel.component.dapr.DaprConstants;
 
 public class DaprOperationResponse {
@@ -57,19 +57,19 @@ public class DaprOperationResponse {
         return create(body, responseHeaders);
     }
 
-    public static DaprOperationResponse createFromWorkflowStatus(WorkflowInstanceStatus workflowStatus) {
+    public static DaprOperationResponse createFromWorkflowStatus(WorkflowState response) {
         Map<String, Object> responseHeaders = new HashMap<>();
 
-        responseHeaders.put(DaprConstants.WORKFLOW_NAME, workflowStatus.getName());
-        responseHeaders.put(DaprConstants.WORKFLOW_CREATED_AT, workflowStatus.getCreatedAt());
-        responseHeaders.put(DaprConstants.WORKFLOW_UPDATED_AT, workflowStatus.getLastUpdatedAt());
-        responseHeaders.put(DaprConstants.WORKFLOW_SERIALIZED_INPUT, workflowStatus.getSerializedInput());
-        responseHeaders.put(DaprConstants.WORKFLOW_SERIALIZED_OUTPUT, workflowStatus.getSerializedOutput());
-        responseHeaders.put(DaprConstants.WORKFLOW_FAILURE_DETAILS, workflowStatus.getFailureDetails());
-        responseHeaders.put(DaprConstants.IS_WORKFLOW_RUNNING, workflowStatus.isRunning());
-        responseHeaders.put(DaprConstants.IS_WORKFLOW_COMPLETED, workflowStatus.isCompleted());
+        responseHeaders.put(DaprConstants.WORKFLOW_NAME, response.getName());
+        responseHeaders.put(DaprConstants.WORKFLOW_CREATED_AT, response.getCreatedAt());
+        responseHeaders.put(DaprConstants.WORKFLOW_UPDATED_AT, response.getLastUpdatedAt());
+        responseHeaders.put(DaprConstants.WORKFLOW_SERIALIZED_INPUT, response.getSerializedInput());
+        responseHeaders.put(DaprConstants.WORKFLOW_SERIALIZED_OUTPUT, response.getSerializedOutput());
+        responseHeaders.put(DaprConstants.WORKFLOW_FAILURE_DETAILS, response.getFailureDetails());
+        responseHeaders.put(DaprConstants.IS_WORKFLOW_RUNNING, response.isRunning());
+        responseHeaders.put(DaprConstants.IS_WORKFLOW_COMPLETED, response.isCompleted());
 
-        return create(workflowStatus, responseHeaders);
+        return create(response, responseHeaders);
     }
 
     public Object getBody() {
diff --git a/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/operations/DaprWorkflowHandler.java b/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/operations/DaprWorkflowHandler.java
index 92d3b5f78db7..6da8646bc551 100644
--- a/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/operations/DaprWorkflowHandler.java
+++ b/components/camel-dapr/src/main/java/org/apache/camel/component/dapr/operations/DaprWorkflowHandler.java
@@ -24,7 +24,7 @@ import java.util.concurrent.TimeoutException;
 import io.dapr.workflows.Workflow;
 import io.dapr.workflows.client.DaprWorkflowClient;
 import io.dapr.workflows.client.NewWorkflowOptions;
-import io.dapr.workflows.client.WorkflowInstanceStatus;
+import io.dapr.workflows.client.WorkflowState;
 import org.apache.camel.Exchange;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.dapr.DaprConfigurationOptionsProxy;
@@ -109,7 +109,7 @@ public class DaprWorkflowHandler implements DaprOperationHandler {
     private DaprOperationResponse purgeWorkflow(Exchange exchange, DaprWorkflowClient client) {
         String instanceId = configurationOptionsProxy.getWorkflowInstanceId(exchange);
 
-        client.purgeInstance(instanceId);
+        client.purgeWorkflow(instanceId);
 
         return DaprOperationResponse.create(null, Map.of(DaprConstants.WORKFLOW_INSTANCE_ID, instanceId));
     }
@@ -138,7 +138,7 @@ public class DaprWorkflowHandler implements DaprOperationHandler {
         String instanceId = configurationOptionsProxy.getWorkflowInstanceId(exchange);
         boolean getWorkflowIO = configurationOptionsProxy.getWorkflowIO(exchange);
 
-        WorkflowInstanceStatus response = client.getInstanceState(instanceId, getWorkflowIO);
+        WorkflowState response = client.getWorkflowState(instanceId, getWorkflowIO);
 
         return DaprOperationResponse.createFromWorkflowStatus(response);
     }
@@ -149,7 +149,7 @@ public class DaprWorkflowHandler implements DaprOperationHandler {
         boolean getWorkflowIO = configurationOptionsProxy.getWorkflowIO(exchange);
 
         try {
-            WorkflowInstanceStatus response = client.waitForInstanceStart(instanceId, timeout, getWorkflowIO);
+            WorkflowState response = client.waitForWorkflowStart(instanceId, timeout, getWorkflowIO);
             return DaprOperationResponse.createFromWorkflowStatus(response);
         } catch (TimeoutException exception) {
             throw new RuntimeCamelException(
@@ -163,7 +163,7 @@ public class DaprWorkflowHandler implements DaprOperationHandler {
         boolean getWorkflowIO = configurationOptionsProxy.getWorkflowIO(exchange);
 
         try {
-            WorkflowInstanceStatus response = client.waitForInstanceCompletion(instanceId, timeout, getWorkflowIO);
+            WorkflowState response = client.waitForWorkflowCompletion(instanceId, timeout, getWorkflowIO);
             return DaprOperationResponse.createFromWorkflowStatus(response);
         } catch (TimeoutException exception) {
             throw new RuntimeCamelException(
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 4c019f3fd07c..88670f4a152d 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
@@ -25,7 +25,7 @@ import io.dapr.workflows.WorkflowStub;
 import io.dapr.workflows.client.DaprWorkflowClient;
 import io.dapr.workflows.client.NewWorkflowOptions;
 import io.dapr.workflows.client.WorkflowFailureDetails;
-import io.dapr.workflows.client.WorkflowInstanceStatus;
+import io.dapr.workflows.client.WorkflowState;
 import org.apache.camel.Exchange;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.dapr.DaprConfiguration;
@@ -173,7 +173,7 @@ public class DaprWorkflowTest extends CamelTestSupport {
         final DaprOperationResponse response = operation.handle(exchange);
 
         assertNotNull(response);
-        verify(client).purgeInstance(instanceId);
+        verify(client).purgeWorkflow(instanceId);
         assertEquals(instanceId, response.getHeaders().get(DaprConstants.WORKFLOW_INSTANCE_ID));
     }
 
@@ -300,7 +300,7 @@ public class DaprWorkflowTest extends CamelTestSupport {
         final boolean isCompleted = false;
         WorkflowFailureDetails failureDetails = mock(WorkflowFailureDetails.class);
 
-        WorkflowInstanceStatus workflowStatus = mock(WorkflowInstanceStatus.class);
+        WorkflowState workflowStatus = mock(WorkflowState.class);
         when(workflowStatus.getName()).thenReturn(name);
         when(workflowStatus.getCreatedAt()).thenReturn(createdAt);
         when(workflowStatus.getLastUpdatedAt()).thenReturn(updatedAt);
@@ -311,7 +311,7 @@ public class DaprWorkflowTest extends CamelTestSupport {
         when(workflowStatus.isCompleted()).thenReturn(isCompleted);
 
         when(endpoint.getWorkflowClient()).thenReturn(client);
-        when(client.getInstanceState(anyString(), any(Boolean.class))).thenReturn(workflowStatus);
+        when(client.getWorkflowState(anyString(), any(Boolean.class))).thenReturn(workflowStatus);
 
         DaprConfiguration configuration = new DaprConfiguration();
         configuration.setOperation(DaprOperation.workflow);
@@ -365,7 +365,7 @@ public class DaprWorkflowTest extends CamelTestSupport {
         final boolean isCompleted = false;
         WorkflowFailureDetails failureDetails = mock(WorkflowFailureDetails.class);
 
-        WorkflowInstanceStatus workflowStatus = mock(WorkflowInstanceStatus.class);
+        WorkflowState workflowStatus = mock(WorkflowState.class);
         when(workflowStatus.getName()).thenReturn(name);
         when(workflowStatus.getCreatedAt()).thenReturn(createdAt);
         when(workflowStatus.getLastUpdatedAt()).thenReturn(updatedAt);
@@ -376,7 +376,7 @@ public class DaprWorkflowTest extends CamelTestSupport {
         when(workflowStatus.isCompleted()).thenReturn(isCompleted);
 
         when(endpoint.getWorkflowClient()).thenReturn(client);
-        when(client.waitForInstanceStart(anyString(), any(Duration.class), any(Boolean.class)))
+        when(client.waitForWorkflowStart(anyString(), any(Duration.class), any(Boolean.class)))
                 .thenReturn(workflowStatus);
 
         DaprConfiguration configuration = new DaprConfiguration();
@@ -409,7 +409,7 @@ public class DaprWorkflowTest extends CamelTestSupport {
         Duration timeout = Duration.ofSeconds(10);
 
         when(endpoint.getWorkflowClient()).thenReturn(client);
-        when(client.waitForInstanceStart(anyString(), any(Duration.class), any(Boolean.class)))
+        when(client.waitForWorkflowStart(anyString(), any(Duration.class), any(Boolean.class)))
                 .thenThrow(TimeoutException.class);
 
         DaprConfiguration configuration = new DaprConfiguration();
@@ -462,7 +462,7 @@ public class DaprWorkflowTest extends CamelTestSupport {
         final boolean isCompleted = false;
         WorkflowFailureDetails failureDetails = mock(WorkflowFailureDetails.class);
 
-        WorkflowInstanceStatus workflowStatus = mock(WorkflowInstanceStatus.class);
+        WorkflowState workflowStatus = mock(WorkflowState.class);
         when(workflowStatus.getName()).thenReturn(name);
         when(workflowStatus.getCreatedAt()).thenReturn(createdAt);
         when(workflowStatus.getLastUpdatedAt()).thenReturn(updatedAt);
@@ -473,7 +473,7 @@ public class DaprWorkflowTest extends CamelTestSupport {
         when(workflowStatus.isCompleted()).thenReturn(isCompleted);
 
         when(endpoint.getWorkflowClient()).thenReturn(client);
-        when(client.waitForInstanceCompletion(anyString(), any(Duration.class), any(Boolean.class)))
+        when(client.waitForWorkflowCompletion(anyString(), any(Duration.class), any(Boolean.class)))
                 .thenReturn(workflowStatus);
 
         DaprConfiguration configuration = new DaprConfiguration();
@@ -506,7 +506,7 @@ public class DaprWorkflowTest extends CamelTestSupport {
         Duration timeout = Duration.ofSeconds(10);
 
         when(endpoint.getWorkflowClient()).thenReturn(client);
-        when(client.waitForInstanceCompletion(anyString(), any(Duration.class), any(Boolean.class)))
+        when(client.waitForWorkflowCompletion(anyString(), any(Duration.class), any(Boolean.class)))
                 .thenThrow(TimeoutException.class);
 
         DaprConfiguration configuration = new DaprConfiguration();