temporalclient

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package temporalclient provides functionality to create and initialize a client for Temporal, a distributed, scalable, durable, and highly available orchestration engine. This package supports configuration with optional mutual TLS (mTLS) for enhanced security.

The main components are the TemporalConfig struct and the NewTemporalClient function, which uses the configuration to create a Temporal client.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCertPathNotSet  = errors.New("client certificate path not set")
	ErrKeyPathNotSet   = errors.New("client key path not set")
	ErrNamespaceNotSet = errors.New("namespace not set")
	ErrHostPortNotSet  = errors.New("host port not set")
	ErrLoggerNotSet    = errors.New("logger not set")
)

Functions

This section is empty.

Types

type TemporalConfig

type TemporalConfig struct {
	ClientKeyPath  string      // Path to the TLS key file
	ClientCertPath string      // Path to the TLS certificate file
	Namespace      string      // Temporal namespace
	HostPort       string      // Host and port of the Temporal service
	MtlsEnabled    bool        // Flag to enable mTLS
	Logger         *zap.Logger // Logger
}

TemporalConfig holds the configuration necessary for setting up a Temporal client. This includes the paths to the TLS certificate and key, the Temporal namespace, the host and port information, and a flag to enable mTLS.

func NewTemporalConfig

func NewTemporalConfig(opts ...TemporalOption) (*TemporalConfig, error)

NewTemporalConfig creates a new instance of TemporalConfig with the provided parameters. This function is a convenient way to create a configuration with all necessary details.

Example:

config := NewTemporalConfig("./ca.key", "./ca.pem", "example_namespace", "localhost:7233", true)

type TemporalExecutorClient

type TemporalExecutorClient struct {
	Client client.Client
	Logger *zap.Logger
}

func New

New creates and initializes a new Temporal client using the provided TemporalConfig. This function handles the setup of mTLS based on the configuration and returns an initialized client.

Example:

config := NewTemporalConfig("./ca.key", "./ca.pem", "example_namespace", "localhost:7233", true)
client, err := NewTemporalClient(config)
if err != nil {
    log.Fatal(err)
}
defer client.Close()

// Use the client...

func (*TemporalExecutorClient) Close

func (c *TemporalExecutorClient) Close()

Close closes the Temporal client.

type TemporalOption

type TemporalOption func(*TemporalConfig)

TemporalOption defines a type for functional options.

func WithCertPath

func WithCertPath(certPath string) TemporalOption

WithCertPath sets the client certificate path.

func WithHostPort

func WithHostPort(hostPort string) TemporalOption

WithPort sets the Temporal port.

func WithKeyPath

func WithKeyPath(keyPath string) TemporalOption

WithKeyPath sets the client key path.

func WithLogger

func WithLogger(logger *zap.Logger) TemporalOption

func WithMtlsEnabled

func WithMtlsEnabled(mtlsEnabled bool) TemporalOption

func WithNamespace

func WithNamespace(namespace string) TemporalOption

WithNamespace sets the Temporal namespace.

Directories

Path Synopsis
Package scheduleclient provides functionalities to interact with a scheduling service, such as creating and managing scheduled tasks.
Package scheduleclient provides functionalities to interact with a scheduling service, such as creating and managing scheduled tasks.

Jump to

Keyboard shortcuts

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