Async Response Handling in a Workflow

@maxim Thanks for your response! What you said makes sense.

I have 2 follow up questions -

1. What will happen if all threads in the workflow thread pool are “awaiting”?

Based on Question about Workflow.await and Workflow.sleep , I gathered Temporal is performing some optimization under the hood to release threads that are doing “workflow.await” if it needs to do work on another workflow.

Just wanted to make sure we don’t run into a situation where all threads in a pool are blocked and prevent new workflow from starting.

Is my understanding of how workflow threads work w.r.t “await” correct?

2. What would this look like when we get an asynchronous response thru event such as Kafka or SQS?

For example,
A → B (submit async reqeust to another service) → C → D → B’ (receives B completion event thru Kafka or SQS)

Not sure how B’ will exactly work with “workflow.await” in this case. Could you please shed some light on how this could work?