0

i have a cadence workflow with 3 activities. Scenario. the first activity is completed while executing second, the workflow failed after retry limit reached. now the problem has been fixed. how can i restart the failed workflow.

i have read this question related question.

i want to know that how can i use reset API in java client sdk to implement it.

cadence-dependence: compile group: 'com.uber.cadence', name: 'cadence-client', version: '3.5.0'

thanks for any help.

jackxu
  • 1
  • 2

2 Answers2

0

The best way is to use iWF for your Cadence/Temporal project:

It is serving REST API for workflow operations. You can use Postman/Curl to reset workflows.

It also has a Java API for reset.

Long Quanzheng
  • 2,076
  • 1
  • 10
  • 22
0

inside the WorkflowServiceTChannel class I found a method ResetWorkflowExecution. through it reset can be acheieved. code show as blow:

public void testReset(String workflowid, String runid, String completeid){
WorkflowClient workflowClient = WorkflowClient.newInstance( new WorkflowServiceTChannel( ClientOptions.newBuilder().setHost("127.0.0.1").setPort(8080).setFeatureFlags(new FeatureFlags().setWorkflowExecutionAlreadyCompletedErrorEnabled(true)).build()), WorkflowClientOptions.newBuilder().setDomain("domain-test").build());
ResetWorkflowExecutionRequest request = new ResetWorkflowExecutionRequest();
WorkflowExecution workflowExecution = new WorkflowExecution();
workflowExecution.setWorkflowId(workflowid);
workflowExecution.setRunId(runid);
request.setRequestId(UUID.randomUUID().toString());
request.setDomain("domain-test");
request.setDecisionFinishEventId(Long.valueOf(completeid));
request.setWorkflowExecution(workflowExecution);
try {
workflowClient.getService().ResetWorkflowExecution(request);
} catch (TException e) {
e.printStackTrace();
}
}

jackxu
  • 1
  • 2