Async Activity Completion v/s Activity + Signal Approach - Workflow and Worker behavior

Hi,

I have been reading temporal docs and some articles around async activity completion. While I have understood the basic working and difference b/w async activity completion and normal activity + signal approach w.r.t different use-cases, I still have a couple of questions.

E.g. Below is the workflow code -

String activityResult = activity.composeGreeting("Hello", name);
if (activityResult == finalResult)
{
      something = doSomething();
}
else {
      something = "dummy";
}
:
:
return activityResult + something;

composeGreeting() is the activity method that calls the external system/service (responsible to asynchronously complete the activity) and returns immediately (because of doNotCompleteOnReturn() ). However, how do the workflow and workflow worker react to that?

Specifically, I am unable to understand what happens to the workflow now that the activity is returning back to the workflow code immediately without the final/correct result.

  1. Is workflow worker released and used for other workflow tasks in the task queue?
  2. Is the workflow in question put to wait/sleep by temporal and resumed once the external system completes the activity with success/failure?
  3. Is async activity completion just an alternate design choice to signal approach (especially for shorter running tasks)? What is the advantage of using async activity completion over a signal approach?
  4. What are the exact steps that temporal executes as soon as the external system invokes activityCompletionClient.complete(...)?

Thanks.

1 Like