How I can set status Failed for my WorkflowId and Name (Java)?

Hi for everybody!

I’v got WorkflowId and Name - How I can set Status Failed for this WorkflowId and Name for Java?

Best regards
Igor

What’s he use case? Do you have a running execution you want to stop?

With client apis you can terminate or cancel a running execution. If you want to fail a workflow execution maybe one idea could be to have a signal handler in your workflow code and signal from client, in signal handler you could then throw/return ApplicationFailure that would fail execution.
Just note that with terminate, execution is terminated on the server, so you have no chance of doing “cleanup” like compensation for example.

Hi tihomir, thanks for your support.

My code is

String terminateObject = “internal_validation_error”;
WorkflowStub newUntypedWorkflowStubM = workflowClient.newUntypedWorkflowStub(orderRequestId.toString());
newUntypedWorkflowStubM.terminate(“internal validation error”, terminateObject); //reason

Best regards
Igor