Difference between workflowClient.newWorkflowStub and Workflow.newExternalWorkflowStub

Hi Team,

I see there are lots of ways to create a client stub like using Workflow.newExternalWorkflowStub, workflowClient.newWorkflowStub etc.,

Can you please suggest when should we use what and if possible it would be great if you can help with any documentation around that topic.

1 Like

The general pattern is that methods that belong to Workflow class can be called only from workflow code. Methods that belong to WorkflowClient class can be called only by non workflow code.

new…WorkflowStub methods have two variants. The first one takes options and creates stub that can be used to start workflow execution. The second takes workflowId and optional runId and can be used to signal and query an existing workflow.