What is the recommended way to send a signal from a Workflow?

I have written workflow A with a signal and query. I want to send a signal from workflow B and workflow C.

On signal calling an external API will take 10 min to complete. once API complete I am adding result to map with key, using query reading the result from the map

looks working but while query getting DEADLINE_EXCEEDED error message with retry is working.

What is the recommended way to send a signal and query from a Workflow?


From workflow code:

      WorkflowToSignal stub =
          Workflow.newExternalWorkflowStub(WorkflowToSignal.class, workflowId);


From workflow code:

	SignalExternalWorkflow(ctx, workflowId, "", signalName, arg).Get(ctx, nil)

Thanks, On the same who to query from a workflow?

No, query from a workflow is not supported. In the majority of cases it is a bad idea. Use a reply signal instead.

Any example on reply signal, Will be help full

It uses the same APIs. Include the originator workflowId and runId into the request signal and let the receiver workflow reply using the passed Ids.

1 Like

Thank you for the clarification it worked!