Develop a Workflow in Go
In the Temporal Go SDK programming model, a Workflow Definition is an exportable function.
In the Temporal Go SDK programming model, a Workflow Definition is an exportable function.
Create an instance of `ActivityOptions` from the `go.temporal.io/sdk/workflow` package and use `WithActivityOptions()` to apply it to the instance of `workflow.Context`.
Create an instance of `StartWorkflowOptions` from the `go.temporal.io/sdk/client` package, and pass the instance to the `ExecuteWorkflow` call.
Add custom Search Attributes to Workflow Executions at start time
Connect a Temporal Client to a Cluster in the Go SDK.
To cause a Workflow to Continue-As-New, use `Workflow.continueAsNew()`.
To cause a Workflow Execution to Continue-As-New, the Workflow function should return the result of the `NewContinueAsNewError()` API available from the `go.temporal.io/sdk/workflow` package.
Wrap your custom functionality around the default Data Converter.
To initialize a Workflow Client, create an instance of a `WorkflowClient`, create a client-side `WorkflowStub`, and then call a Workflow method (annotated with the `@WorkflowMethod` annotation).
First, enable Sessions on the Worker via the Worker Options and then use the `CreateSession` API to create a Context object that can be passed to the calls to spawn Activity Executions.
To customize the Workflow Type set the `Name` parameter with `RegisterOptions` when registering your Workflow with a Worker.
The Activity Type defaults to method name with the first letter of the method name capitalized, and can be customized using `namePrefix()` or `{ActivityMethod.name()}` to ensure they are distinct.
To customize the Workflow Type set the `Name` parameter with `RegisterOptions` when registering your Workflow with a Worker.
The Workflow Type defaults to the short name of the Workflow interface, and can be customized with the `name` parameter.
Create a Query handler using the `@QueryMethod` annotation in the Workflow interface.
An Activity interface can have any number of parameters.
Activity return values must be serializable and deserializable by the provided `DataConverter`
Define a Signal method with `@SignalMethod` annotation in the Workflow interface.
A method annotated with `@WorkflowMethod` can have any number of parameters.
Workflow method arguments and return values must be serializable and deserializable using the provided `DataConverter`.
Develop an instance of a Worker by calling `worker.New()`, available via the `go.temporal.io/sdk/worker` package.
Use the `newWorker` method on an instance of a `WorkerFactory` to create a new Worker in Java.
In the Temporal Java SDK programming model, a Workflow is a class which implements a Workflow interface.
In the Temporal Java SDK programming model, a Workflow is a class which implements a Workflow interface.
In the Temporal Java SDK programming model, Activities are classes which implement the Activity Interface.
In the Temporal Go SDK programming model, an Activity Definition is an exportable function or `stuct` method.
In the Temporal Java SDK programming model, Activities are classes which implement the Activity Interface.
To emit metrics with the Java SDK, use `WorkflowServiceStubsOptions.Builder.setMetricsScope` to set the metrics scope in your Worker or Client code.
Use the SideEffect API from the `go.temporal.io/sdk/workflow` package to execute a Side Effect directly in your Workflow.
Use the Future returned by `ExecuteWorkflow` API call to retrieve the result.
A synchronous Workflow Execution blocks your client thread until the Workflow Execution completes (or fails) and get the results (or error in case of failure). An asynchronous Workflow Execution immediately returns a value to the caller.
To get the results of an asynchronously invoked Activity method, use the `Promise` `get` method to block until the Activity method result is available.
Use the Future returned from the `ExecuteActivity` API call to retrieve the result.
To handle a Query in a Workflow, define a Query handler method using the `@QueryMethod` annotation in the Workflow interface.
Use the `@SignalMethod` annotation to handle Signals within the Workflow interface.
When defining Workflows using the Temporal Java SDK, the Workflow code must be written to execute effectively once and to completion.
Use, the `RecordHeartbeat` API to report that the execution is alive and progressing.
To inform the Temporal service that the Activity is still alive, use `Activity.getExecutionContext().heartbeat()` in the Activity implementation code.
List Workflow Executions using the Client
Log from a Workflow
Providing authorization header to Temporal Server in Java SDK including JWT tokens
Use the `RegisterNamespaceRequest` API to register a Namespace and set the Retention Period for the Workflow Execution Event History for the Namespace.
Use `worker.registerWorkflowImplementationTypes` to register Workflow Type and `worker.registerActivitiesImplementations` to register Activity implementation with Workers.
How to remove Search Attributes from a Workflow
Use the `CancelWorkflow` API to cancel a Workflow Execution using its Id.
To send a Query to a Workflow Execution from an external process, call the Query method (defined in the Workflow) from a `WorkflowStub` within the Client code.
To send a Signal to a Workflow Execution from a Client, call the Signal method, annotated with `@SignalMethod` in the Workflow interface, from the Client code.
To send a Signal from within a Workflow to a different Workflow Execution, initiate an `ExternalWorkflowStub` in the implementation of the current Workflow and call the Signal method defined in the other Workflow.
To send Signals to a Workflow Execution whose status is unknown, use `SignalWithStart` with a `WorkflowStub` in the Client code.
Set the Cron Schedule with the `WorkflowStub` instance in the Client code using [`WorkflowOptions.Builder.setCronSchedule`
Set the Workflow Id with the `WorkflowStub` instance in the Client code using `WorkflowOptions.Builder.setWorkflowId`.
To set a Heartbeat Timeout, use `ActivityOptions.newBuilder.setHeartbeatTimeout`].
To set a Schedule-To-Close Timeout, use `ActivityOptions.newBuilder.setScheduleToCloseTimeout`].
To set a Schedule-To-Start Timeout, use `ActivityOptions.newBuilder.setScheduleToStartTimeout`].
To set a Start-To-Close Timeout, use `ActivityOptions.newBuilder.setStartToCloseTimeout`].
Set the Workflow Execution Timeout with the `WorkflowStub` instance in the Client code using `WorkflowOptions.Builder.setWorkflowExecutionTimeout`.
Set the Workflow Run Timeout with the `WorkflowStub` instance in the Client code using `WorkflowOptions.Builder.setWorkflowRunTimeout`.
Set the Workflow Task Timeout with the `WorkflowStub` instance in the Client code using `WorkflowOptions.Builder.setWorkflowTaskTimeout`.
To set a Heartbeat Timeout, use `ActivityOptions.newBuilder.setHeartbeatTimeout`].
Activity Timeouts
Use `ActivityOptions` to configure how to invoke an Activity Execution.
Used to set all Child Workflow Execution specific options
Set Child Workflow specific options with the `ChildWorkflowOptions` class.
Create an instance of `Options` from the `go.temporal.io/sdk/client` package and pass it the call to create a new Temporal Client.
Options to control optional connection params
Used to set local activity specific parameters that will be stored inside of a context
Use the `ConnectionOptions` API available in the `go.temporal.io/sdk/client` package to connect a Client with mTLS.
To set the mTLS configuration in Java, provide the certificate and private key in an instance of `WorkflowServiceStub`.
To use MutableSideEffect() in Go, provide the Workflow Id.
Set `Parent Close Policy` on an instance of `ChildWorkflowOptions` using `ChildWorkflowOptions.newBuilder().setParentClosePolicy`.
Create an instance of `RegisterOptions` from the `go.temporal.io/sdk/activity` package and pass it to the `RegisterActivityWithOptions` call when registering the Activity Type with the Worker.
Create an instance of `RegisterOptions` from the `go.temporal.io/sdk/workflow` package and pass it to the `RegisterWorkflowWithOptions` call when registering the Workflow Type with the Worker
Create an instance of `SessionOptions` and pass it to the `CreateSession()` API call.
Set the Workflow Task Queue with the `WorkflowStub` instance in the Client code using `WorkflowOptions.Builder.setTaskQueue`.
Create an instance of `Options` from the `go.temporal.io/sdk/worker` package, set any of the optional fields, and pass the instance to the `New` call.
Set Workflow Retry Options in the `WorkflowStub` instance using `WorkflowOptions.Builder.setWorkflowRetryOptions`.
Set the Workflow Execution Timeout with the `WorkflowStub` instance in the Client code using `WorkflowOptions.Builder.setWorkflowExecutionTimeout`.
Set `WorkflowClient` specific options with the `WorkflowClientOptions` class.
Set `WorkflowServiceStub` specific options with the `WorkflowServiceStubOptions` class.
Use the `ExecuteChildWorkflow`, available from the `go.temporal.io/sdk/workflow` package, to spawn a Child Workflow Execution in Go.
Use the `ExecuteChildWorkflow`, available from the `go.temporal.io/sdk/workflow` package, to spawn a Child Workflow Execution in Go.
The first call to the Child Workflow stub can be synchronous or asynchronous using `Async.function(Functions.Func)` or `Async.procedure(Functions.Proc)`, and must always be to a method annotated with `@WorkflowMethod`.
Use the `ExecuteWorkflow()` method on the Go SDK `Client`, which is available via `Dial()` in the `go.temporal.io/sdk/client` package.
Use `WorkflowStub` to start a Workflow Execution from within a Client, and `ExternalWorkflowStub` to start a different Workflow Execution from within a Workflow.
Use the `ExecuteActivity()` API call available from the `go.temporal.io/sdk/workflow` package.
Invoke Activities using `Workflow.newActivityStub`(type-safe) or `Workflow.newUntypedActivityStub` (untyped) from within a Workflow.
In advanced cases, you may want to dynamically update these attributes as the Workflow progresses.
A Side Effect is a method of execution to produce nondeterministic code.
A Query is sent from a Temporal Client to a Workflow Execution and is identified by its name.
Define a Query method inside the Workflow interface, annotated with the `@QueryMethod` annotation and call the method from an external process.
Use the `SignalWorkflow()` method on and instance of the Go SDK Temporal Client to send a Signal to a Workflow Execution.
Initiate the Signal method with `@SignalMethod` annotation in the Workflow interface and call it either directly from the Client or from within another Workflow.
Add the Temporal Go SDK to your project.
Add the Temporal Java SDK to your project.
Use `ActivityOptions` to configure how to invoke an Activity Execution.
Create a `newWorkflowStub` in the Temporal Client code, call the instance of the Workflow, and set the Workflow options with the `WorkflowOptions.Builder` class.