Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions daprdocs/content/en/java-sdk-docs/java-client/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ public class DemoWorkflowClient {

System.out.println(separatorStr);
System.out.println("**GetInstanceMetadata:Running Workflow**");
WorkflowInstanceStatus workflowMetadata = client.getInstanceState(instanceId, true);
WorkflowInstanceStatus workflowMetadata = client.getWorkflowState(instanceId, true);
System.out.printf("Result: %s%n", workflowMetadata);

System.out.println(separatorStr);
Expand Down Expand Up @@ -545,13 +545,13 @@ public class DemoWorkflowClient {


System.out.println(separatorStr);
System.out.println("**WaitForInstanceCompletion**");
System.out.println("**waitForWorkflowCompletion**");
try {
WorkflowInstanceStatus waitForInstanceCompletionResult =
client.waitForInstanceCompletion(instanceId, Duration.ofSeconds(60), true);
System.out.printf("Result: %s%n", waitForInstanceCompletionResult);
WorkflowInstanceStatus waitForWorkflowCompletionResult =
client.waitForWorkflowCompletion(instanceId, Duration.ofSeconds(60), true);
System.out.printf("Result: %s%n", waitForWorkflowCompletionResult);
} catch (TimeoutException ex) {
System.out.printf("waitForInstanceCompletion has an exception:%s%n", ex);
System.out.printf("waitForWorkflowCompletion has an exception:%s%n", ex);
}

System.out.println(separatorStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public class DemoWorkflowClient {

System.out.println(separatorStr);
System.out.println("**GetInstanceMetadata:Running Workflow**");
WorkflowInstanceStatus workflowMetadata = client.getInstanceState(instanceId, true);
WorkflowInstanceStatus workflowMetadata = client.getWorkflowState(instanceId, true);
System.out.printf("Result: %s%n", workflowMetadata);

System.out.println(separatorStr);
Expand Down Expand Up @@ -135,13 +135,13 @@ public class DemoWorkflowClient {


System.out.println(separatorStr);
System.out.println("**WaitForInstanceCompletion**");
System.out.println("**waitForWorkflowCompletion**");
try {
WorkflowInstanceStatus waitForInstanceCompletionResult =
client.waitForInstanceCompletion(instanceId, Duration.ofSeconds(60), true);
System.out.printf("Result: %s%n", waitForInstanceCompletionResult);
WorkflowInstanceStatus waitForWorkflowCompletionResult =
client.waitForWorkflowCompletion(instanceId, Duration.ofSeconds(60), true);
System.out.printf("Result: %s%n", waitForWorkflowCompletionResult);
} catch (TimeoutException ex) {
System.out.printf("waitForInstanceCompletion has an exception:%s%n", ex);
System.out.printf("waitForWorkflowCompletion has an exception:%s%n", ex);
}

System.out.println(separatorStr);
Expand Down Expand Up @@ -213,7 +213,7 @@ Events raised for workflow with instanceId: 0b4cc0d5-413a-4c1c-816a-a71fa24740d4
** Registering Event to be captured by anyOf(t1,t2,t3) **
Event raised for workflow with instanceId: 0b4cc0d5-413a-4c1c-816a-a71fa24740d4
*******
**WaitForInstanceCompletion**
**WaitForWorkflowCompletion**
Result: [Name: 'io.dapr.examples.workflows.DemoWorkflow', ID: '0b4cc0d5-413a-4c1c-816a-a71fa24740d4', RuntimeStatus: FAILED, CreatedAt: 2023-09-13T13:02:30.547Z, LastUpdatedAt: 2023-09-13T13:02:55.054Z, Input: '"input data"', Output: '']
*******
**purgeInstance**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.dapr.examples.workflows.utils.PropertyUtils;
import io.dapr.examples.workflows.utils.RetryUtils;
import io.dapr.workflows.client.DaprWorkflowClient;
import io.dapr.workflows.client.WorkflowInstanceStatus;
import io.dapr.workflows.client.WorkflowState;

import java.time.Duration;
import java.util.concurrent.TimeoutException;
Expand All @@ -34,10 +34,10 @@ public static void main(String[] args) {
Duration.ofSeconds(60));

System.out.printf("Started a new chaining model workflow with instance ID: %s%n", instanceId);
WorkflowInstanceStatus workflowInstanceStatus =
client.waitForInstanceCompletion(instanceId, null, true);
WorkflowState workflowState =
client.waitForWorkflowCompletion(instanceId, null, true);

String result = workflowInstanceStatus.readOutputAs(String.class);
String result = workflowState.readOutputAs(String.class);
System.out.printf("workflow instance with ID: %s completed with result: %s%n", instanceId, result);
} catch (TimeoutException | InterruptedException e) {
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import io.dapr.examples.workflows.utils.PropertyUtils;
import io.dapr.workflows.client.DaprWorkflowClient;
import io.dapr.workflows.client.WorkflowInstanceStatus;
import io.dapr.workflows.client.WorkflowState;

import java.util.concurrent.TimeoutException;

Expand All @@ -30,10 +30,10 @@ public static void main(String[] args) {
try (DaprWorkflowClient client = new DaprWorkflowClient(PropertyUtils.getProperties(args))) {
String instanceId = client.scheduleNewWorkflow(DemoWorkflow.class);
System.out.printf("Started a new child-workflow model workflow with instance ID: %s%n", instanceId);
WorkflowInstanceStatus workflowInstanceStatus =
client.waitForInstanceCompletion(instanceId, null, true);
WorkflowState workflowState =
client.waitForWorkflowCompletion(instanceId, null, true);

String result = workflowInstanceStatus.readOutputAs(String.class);
String result = workflowState.readOutputAs(String.class);
System.out.printf("workflow instance with ID: %s completed with result: %s%n", instanceId, result);

} catch (TimeoutException | InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.dapr.examples.workflows.utils.PropertyUtils;
import io.dapr.examples.workflows.utils.RetryUtils;
import io.dapr.workflows.client.DaprWorkflowClient;
import io.dapr.workflows.client.WorkflowInstanceStatus;
import io.dapr.workflows.client.WorkflowState;

import java.time.Duration;
import java.util.concurrent.TimeoutException;
Expand All @@ -27,7 +27,7 @@ public static void main(String[] args) {
String instanceId = RetryUtils.callWithRetry(() -> client.scheduleNewWorkflow(BookTripWorkflow.class), Duration.ofSeconds(60));
System.out.printf("Started a new trip booking workflow with instance ID: %s%n", instanceId);

WorkflowInstanceStatus status = client.waitForInstanceCompletion(instanceId, Duration.ofMinutes(30), true);
WorkflowState status = client.waitForWorkflowCompletion(instanceId, Duration.ofMinutes(30), true);
System.out.printf("Workflow instance with ID: %s completed with status: %s%n", instanceId, status);
System.out.printf("Workflow output: %s%n", status.getSerializedOutput());
} catch (TimeoutException | InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static void main(String[] args) {
String instanceId = client.scheduleNewWorkflow(DemoContinueAsNewWorkflow.class);
System.out.printf("Started a new continue-as-new model workflow with instance ID: %s%n", instanceId);

client.waitForInstanceCompletion(instanceId, null, true);
client.waitForWorkflowCompletion(instanceId, null, true);
System.out.printf("workflow instance with ID: %s completed.", instanceId);

} catch (TimeoutException | InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void main(String[] args) {
client.raiseEvent(instanceId, "Approval", true);
//client.raiseEvent(instanceId, "Approval", false);

client.waitForInstanceCompletion(instanceId, null, true);
client.waitForWorkflowCompletion(instanceId, null, true);
System.out.printf("workflow instance with ID: %s completed.", instanceId);

} catch (TimeoutException | InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.dapr.examples.workflows.utils.PropertyUtils;
import io.dapr.examples.workflows.utils.RetryUtils;
import io.dapr.workflows.client.DaprWorkflowClient;
import io.dapr.workflows.client.WorkflowInstanceStatus;
import io.dapr.workflows.client.WorkflowState;

import java.time.Duration;
import java.util.Arrays;
Expand Down Expand Up @@ -48,12 +48,12 @@ public static void main(String[] args) throws InterruptedException {
System.out.printf("Started a new fan out/fan in model workflow with instance ID: %s%n", instanceId);

// Block until the orchestration completes. Then print the final status, which includes the output.
WorkflowInstanceStatus workflowInstanceStatus = client.waitForInstanceCompletion(
WorkflowState workflowState = client.waitForWorkflowCompletion(
instanceId,
Duration.ofSeconds(30),
true);
System.out.printf("workflow instance with ID: %s completed with result: %s%n", instanceId,
workflowInstanceStatus.readOutputAs(int.class));
workflowState.readOutputAs(int.class));
} catch (TimeoutException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package io.dapr.examples.workflows.multiapp;

import io.dapr.workflows.client.DaprWorkflowClient;
import io.dapr.workflows.client.WorkflowInstanceStatus;
import io.dapr.workflows.client.WorkflowState;

import java.util.concurrent.TimeoutException;

Expand Down Expand Up @@ -48,8 +48,8 @@ public static void main(String[] args) {

// Wait for the workflow to complete
System.out.println("Waiting for workflow completion...");
WorkflowInstanceStatus workflowInstanceStatus =
client.waitForInstanceCompletion(instanceId, null, true);
WorkflowState workflowInstanceStatus =
client.waitForWorkflowCompletion(instanceId, null, true);

// Get the result
String result = workflowInstanceStatus.readOutputAs(String.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io.dapr.examples.workflows.utils.PropertyUtils;
import io.dapr.examples.workflows.utils.RetryUtils;
import io.dapr.workflows.client.DaprWorkflowClient;
import io.dapr.workflows.client.WorkflowInstanceStatus;
import io.dapr.workflows.client.WorkflowState;

import java.time.Duration;
import java.util.concurrent.TimeoutException;
Expand All @@ -38,21 +38,21 @@ public static void main(String[] args) {
System.out.printf("Suspending Workflow Instance: %s%n", instanceId );
client.suspendWorkflow(instanceId, "suspending workflow instance.");

WorkflowInstanceStatus instanceState = client.getInstanceState(instanceId, false);
WorkflowState instanceState = client.getWorkflowState(instanceId, false);
assert instanceState != null;
System.out.printf("Workflow Instance Status: %s%n", instanceState.getRuntimeStatus().name() );

System.out.printf("Let's resume the Workflow Instance before sending the external event: %s%n", instanceId );
client.resumeWorkflow(instanceId, "resuming workflow instance.");

instanceState = client.getInstanceState(instanceId, false);
instanceState = client.getWorkflowState(instanceId, false);
assert instanceState != null;
System.out.printf("Workflow Instance Status: %s%n", instanceState.getRuntimeStatus().name() );

System.out.printf("Now that the instance is RUNNING again, lets send the external event. %n");
client.raiseEvent(instanceId, "Approval", true);

client.waitForInstanceCompletion(instanceId, null, true);
client.waitForWorkflowCompletion(instanceId, null, true);
System.out.printf("workflow instance with ID: %s completed.", instanceId);

} catch (TimeoutException | InterruptedException e) {
Expand Down
Loading
Loading