Hello, i’m stuck in the case same as the following example.
In my workflow, i start some normally go code(doSth1).
and then by some condition i want execute an activity in the code, but i lost the workflow.Context.
Should i build a new workflow.Context from context.context and how.
thanks again.
Yes, I know that. In fact i want to know is it possible and reliable to convert context.Context to workflow.Context or build a new workflow.Context from some info.
Short answer is no, you cannot reliably convert context.Context to workflow.Context or build from scratch.
Longer answer:
Temporal designed it’s own workflow.Context interface and the underlying implementation in order to handle concurrency in workflow execution and history replay deterministically.
The reason is that in Go, selectchooses channels randomly when multiple of them are available to proceed. This would make Workflow history reply non-deterministic. To overcome that, Temporal implemented it’s own channel, selector, and it’s strictly ordered signal processing.