Java retrieve active WF

Hi all,

is there a way that allows me to have the current active WF by taskQueue or workflowID?
I’m in a distribuited architecture and i want to call a SignalMethod of the active WF.

Thx a lot.
A.

I’m not sure I understand the question correctly.

You don’t need to do anything special to signal a workflow by the WorkflowId. If RunId is not specified then the currently running workflow is always selected as the signal target.

hi maxim,

I need to invoke a signal through an api. not having the workflow instance, I can somehow recover the
active workflow to be able to trigger the signal on this instance?

thx

i was successfull using this:

@PostMapping("ee")
public void callback(@RequestParam(name = "value", required = true) Boolean value) {
     WorkflowServiceStubs.newInstance().blockingStub().signalWorkflowExecution(SignalWorkflowExecutionRequest.newBuilder()
            .setNamespace(NAMESPACE)
            .setSignalName(SIGNAL_NAME")
            .setWorkflowExecution(WorkflowExecution.newBuilder().setWorkflowId(MY_WF_ID).build()).build());
}

it’s correct?
how can i pass the parameters?

thx a lot

I think using gRPC API directly, in this case, is not the simplest way to achieve your goal. The supported way is to use the workflow stub:

MyWorkflow stub = client.NewWorkflowStub(MyWorkflow.class, "<workflowId>");
stub.<signalMethod>(...);

thanks maxim, works like a charm

1 Like