Workflow Definitions
Our Docs modernization effort is underway. New documentation will co-exist alongside our current docs content. We're rebuilding the docs for better organization and engagement so you can find what you need to know with clear unambiguous communication.
A Workflow Definition is the code that defines the Workflow. It is written with a programming language and corresponding Temporal SDK. Depending on the programming language, it's typically implemented as a function or an object method and encompasses the end-to-end series of steps of a Temporal application.
Below are different ways to develop a basic Workflow Definition.
- Go
- Java
- PHP
- Python
- Typescript
- .NET
func YourBasicWorkflow(ctx workflow.Context) error {
// ...
return nil
}
Workflow Definition in Java (Interface)
// Workflow interface
@WorkflowInterface
public interface YourBasicWorkflow {
@WorkflowMethod
String workflowMethod(Arguments args);
}
Workflow Definition in Java (Implementation)
// Workflow implementation
public class YourBasicWorkflowImpl implements YourBasicWorkflow {
// ...
}
Workflow Definition in PHP (Interface)
#[WorkflowInterface]
interface YourBasicWorkflow {
#[WorkflowMethod]
public function workflowMethod(Arguments args);
}
Workflow Definition in PHP (Implementation)
class YourBasicWorkflowImpl implements YourBasicWorkflow {
// ...
}
@workflow.defn
class YourWorkflow:
@workflow.run
async def YourBasicWorkflow(self, input: str) -> str:
# ...
Workflow Definition in Typescript
type BasicWorkflowArgs = {
param: string;
};
export async function WorkflowExample(
args: BasicWorkflowArgs,
): Promise<{ result: string }> {
// ...
}
Workflow Definition in C# and .NET
[Workflow]
public class YourBasicWorkflow {
[WorkflowRun]
public async Task<string> workflowExample(string param) {
// ...
}
}