Let me review what you wrote in detail and make comments, ask clarification questions:
Context:
A workflow is a collection of actions performed by persons and/or automated functions, that are orchestrated, in a step by step way, flowchart like, tied together through some (conditional) business logic – there are sequential and parallel paths, loops, as well as conditional branches.
From a technical point of view, a workflow is code that invokes UIs that present work steps to persons and invokes code that automated actions. There is also information passing around invocations.
The information passed around is typically minimal – such as a case id, since workflows are most typically supported by a backend database which holds all relevant information.
re: The Workflow Definition is the function that specifies your business logic.
So, given the above I would expect a workflow function to describe step-by-step action invocations tied together through some business logic.
The workflow code is defined in a workflow application - and this application is not physically transferred to the temporal server but runs on its own application server.
So i expect the workflow application to communicate workflow “intents” with the temporal server through the API.
The temporal server is then responsible for invoking actions according to the workflow logic.
This also means that there must be a “dialog” between a workflow application and the termporal server as so:
The workflow application tells the temporal server to invoke an action.
The temporal server invokes the action and receives a response
The temporal server provides the response to the workflow application.
The workflow application then determines what to do next, based on business logic.
To make the following possible, there is a need to register Actions with the temporal server. The actions identifiers are based on the action declarations included in the workflow application. The identifiers are also used by the temporal server to invoke the right action.
Actions could be invoked directly by the temporal server or indirectly via work queues, which is a better approach in asynchronous work environments.
A work queue is basically an inbox – an action checks the inbox to see if work needs to be done.
Its possible that an inbox could queue action requests from more than one executing workflow instance.
Finally, actions receive at a minimum a case id with which they can determine a current state of a case is and then do their action.
–
To ensure resilient execution the temporal server also ensures that action orchestration is resilient to failure, and if a failure occurs in one action it is communicated to the workflow application – who is called upon handing the failure business logic.
Maybe something like this: