sdk

module
v1.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2024 License: MIT

README

Temporal Go SDK Build Status PkgGoDev

Temporal is a distributed, scalable, durable, and highly available orchestration engine used to execute asynchronous long-running business logic in a scalable and resilient way.

"Temporal Go SDK" is the framework for authoring workflows and activities using Go language.

How to use

Clone this repo into the preferred location.

git clone https://github.com/temporalio/sdk-go.git

See samples to get started.

Documentation is available here. You can also find the API documentation here.

Using slog

If using Go version 1.21+ the Go SDK provides built in integration with the standard slog package.

package main
import (
	"log/slog"
	"os"

	"go.temporal.io/sdk/client"
	"go.temporal.io/sdk/log"
	"go.temporal.io/sdk/worker"
)

func main() {
	clientOptions := client.Options{
		Logger: log.NewStructuredLogger(
			slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
				AddSource: true,
				Level:     slog.LevelDebug,
			}))),
	}
	temporalClient, err := client.Dial(clientOptions)
	// ...
}

Workflow determinism checker

See contrib/tools/workflowcheck for a tool to detect non-determinism in Workflow Definitions.

Contributing

We'd love your help in making the Temporal Go SDK great. Please review our contribution guidelines.

Go build and run tags

Prior to SDK version v1.26.0 our protobuf code generator allowed invalid UTF-8 data to be stored as proto strings. This isn't actually allowed by the proto3 spec, so if you're using our SDK and think you may store arbitrary binary data in our strings you should set -tags protolegacy when building against our SDK.

Example:

$ go build -tags protolegacy myworker/main.go

If you see an error like grpc: error unmarshalling request: string field contains invalid UTF-8 then you will need to enable this when building your code.

If you're unsure then you should specify it anyways as there's no harm in doing so unless you relied on the protobuf compiler to ensure all strings were valid UTF-8.

License

MIT License, please see LICENSE for details.

Directories

Path Synopsis
Package activity contains functions and types used to implement Temporal Activities.
Package activity contains functions and types used to implement Temporal Activities.
Package client is used by external programs to communicate with Temporal service.
Package client is used by external programs to communicate with Temporal service.
contrib
datadog Module
opentelemetry Module
opentracing Module
tally Module
Package interceptor contains interceptors for client and worker calls.
Package interceptor contains interceptors for client and worker calls.
cmd/dummy
This file exists to force compilation of all code that doesn't have unit tests.
This file exists to force compilation of all code that doesn't have unit tests.
interceptortest
Package interceptortest contains internal utilities for testing interceptors.
Package interceptortest contains internal utilities for testing interceptors.
log
Package internalbindings contains low level APIs to be used by non Go SDKs built on top of the Go SDK.
Package internalbindings contains low level APIs to be used by non Go SDKs built on top of the Go SDK.
Package temporal and its subdirectories contain the Temporal client side framework.
Package temporal and its subdirectories contain the Temporal client side framework.
Package testsuite contains unit testing framework for Temporal workflows and activities and a helper to download and start a dev server.
Package testsuite contains unit testing framework for Temporal workflows and activities and a helper to download and start a dev server.
Package worker contains functions to manage lifecycle of a Temporal client side worker.
Package worker contains functions to manage lifecycle of a Temporal client side worker.
Package workflow contains functions and types used to implement Temporal workflows.
Package workflow contains functions and types used to implement Temporal workflows.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL