client

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultWorkItemMaxReceiveBytes = 16 << 20

DefaultWorkItemMaxReceiveBytes bounds each streamed work item to 16 MiB. Hosts must also configure their server's request limits for large payloads.

Variables

View Source
var ErrWorkItemStreamExhausted = errors.New("work item stream resource retry budget exhausted")

ErrWorkItemStreamExhausted signals that a listener stopped after three ResourceExhausted receive errors without receiving work in between.

Functions

This section is empty.

Types

type TaskHubGrpcClient

type TaskHubGrpcClient struct {
	// contains filtered or unexported fields
}

func NewTaskHubGrpcClient

func NewTaskHubGrpcClient(cc grpc.ClientConnInterface, logger backend.Logger, opts ...TaskHubGrpcClientOption) *TaskHubGrpcClient

NewTaskHubGrpcClient creates a client that can be used to manage workflows over a gRPC connection. The gRPC connection must be to a task hub worker that understands the Durable Task gRPC protocol.

func (*TaskHubGrpcClient) FetchOrchestrationMetadata deprecated

func (c *TaskHubGrpcClient) FetchOrchestrationMetadata(ctx context.Context, id api.InstanceID, opts ...api.FetchWorkflowMetadataOptions) (*backend.WorkflowMetadata, error)

Deprecated: Use FetchWorkflowMetadata instead.

func (*TaskHubGrpcClient) FetchWorkflowMetadata

FetchWorkflowMetadata fetches metadata for the specified workflow from the configured task hub.

api.ErrInstanceNotFound is returned when the specified workflow doesn't exist.

func (*TaskHubGrpcClient) GetInstanceHistory

func (*TaskHubGrpcClient) ListInstanceIDs

func (*TaskHubGrpcClient) PurgeOrchestrationState deprecated

func (c *TaskHubGrpcClient) PurgeOrchestrationState(ctx context.Context, id api.InstanceID, opts ...api.PurgeOptions) error

Deprecated: Use PurgeWorkflowState instead.

func (*TaskHubGrpcClient) PurgeWorkflowState

func (c *TaskHubGrpcClient) PurgeWorkflowState(ctx context.Context, id api.InstanceID, opts ...api.PurgeOptions) error

PurgeWorkflowState deletes the state of the specified workflow instance.

api.ErrInstanceNotFound is returned if the specified workflow instance doesn't exist.

func (*TaskHubGrpcClient) RaiseEvent

func (c *TaskHubGrpcClient) RaiseEvent(ctx context.Context, id api.InstanceID, eventName string, opts ...api.RaiseEventOptions) error

RaiseEvent sends an asynchronous event notification to a waiting workflow.

func (*TaskHubGrpcClient) ResumeOrchestration deprecated

func (c *TaskHubGrpcClient) ResumeOrchestration(ctx context.Context, id api.InstanceID, reason string) error

Deprecated: Use ResumeWorkflow instead.

func (*TaskHubGrpcClient) ResumeWorkflow

func (c *TaskHubGrpcClient) ResumeWorkflow(ctx context.Context, id api.InstanceID, reason string, opts ...api.ResumeOptions) error

ResumeWorkflow resumes a workflow instance that was previously suspended.

func (*TaskHubGrpcClient) ScheduleNewOrchestration deprecated

func (c *TaskHubGrpcClient) ScheduleNewOrchestration(ctx context.Context, workflow string, opts ...api.NewWorkflowOptions) (api.InstanceID, error)

Deprecated: Use ScheduleNewWorkflow instead.

func (*TaskHubGrpcClient) ScheduleNewWorkflow

func (c *TaskHubGrpcClient) ScheduleNewWorkflow(ctx context.Context, workflow string, opts ...api.NewWorkflowOptions) (api.InstanceID, error)

ScheduleNewWorkflow schedules a new workflow instance with a specified set of options for execution.

func (*TaskHubGrpcClient) StartWorkItemListener

func (c *TaskHubGrpcClient) StartWorkItemListener(ctx context.Context, r *task.TaskRegistry) error

func (*TaskHubGrpcClient) SuspendOrchestration deprecated

func (c *TaskHubGrpcClient) SuspendOrchestration(ctx context.Context, id api.InstanceID, reason string) error

Deprecated: Use SuspendWorkflow instead.

func (*TaskHubGrpcClient) SuspendWorkflow

func (c *TaskHubGrpcClient) SuspendWorkflow(ctx context.Context, id api.InstanceID, reason string, opts ...api.SuspendOptions) error

SuspendWorkflow suspends a workflow instance, halting processing of its events until a "resume" operation resumes it.

Note that suspended workflows are still considered to be "running" even though they will not process events.

func (*TaskHubGrpcClient) TerminateOrchestration deprecated

func (c *TaskHubGrpcClient) TerminateOrchestration(ctx context.Context, id api.InstanceID, opts ...api.TerminateOptions) error

Deprecated: Use TerminateWorkflow instead.

func (*TaskHubGrpcClient) TerminateWorkflow

func (c *TaskHubGrpcClient) TerminateWorkflow(ctx context.Context, id api.InstanceID, opts ...api.TerminateOptions) error

TerminateWorkflow terminates a running workflow by causing it to stop receiving new events and putting it directly into the TERMINATED state.

func (*TaskHubGrpcClient) WaitForOrchestrationCompletion deprecated

func (c *TaskHubGrpcClient) WaitForOrchestrationCompletion(ctx context.Context, id api.InstanceID, opts ...api.FetchWorkflowMetadataOptions) (*backend.WorkflowMetadata, error)

Deprecated: Use WaitForWorkflowCompletion instead.

func (*TaskHubGrpcClient) WaitForOrchestrationStart deprecated

func (c *TaskHubGrpcClient) WaitForOrchestrationStart(ctx context.Context, id api.InstanceID, opts ...api.FetchWorkflowMetadataOptions) (*backend.WorkflowMetadata, error)

Deprecated: Use WaitForWorkflowStart instead.

func (*TaskHubGrpcClient) WaitForWorkflowCompletion

func (c *TaskHubGrpcClient) WaitForWorkflowCompletion(ctx context.Context, id api.InstanceID, opts ...api.FetchWorkflowMetadataOptions) (*backend.WorkflowMetadata, error)

WaitForWorkflowCompletion waits for a workflow to complete and returns an backend.WorkflowMetadata object that contains metadata about the completed instance.

api.ErrInstanceNotFound is returned when the specified workflow doesn't exist.

func (*TaskHubGrpcClient) WaitForWorkflowStart

WaitForWorkflowStart waits for a workflow to start running and returns an backend.WorkflowMetadata object that contains metadata about the started instance.

api.ErrInstanceNotFound is returned when the specified workflow doesn't exist.

type TaskHubGrpcClientOption

type TaskHubGrpcClientOption func(*TaskHubGrpcClient)

TaskHubGrpcClientOption configures a TaskHubGrpcClient.

func WithStatefulHistoryDisabled

func WithStatefulHistoryDisabled() TaskHubGrpcClientOption

WithStatefulHistoryDisabled opts the worker out of the stateful-history optimization: it does not advertise WORKER_CAPABILITY_STATEFUL_HISTORY, so the sidecar sends the full history on every turn and the worker keeps no history cache. Use to fall back to the pre-optimization behavior.

func WithWorkItemListenerErrorHandler added in v1.2.2

func WithWorkItemListenerErrorHandler(handler func(error)) TaskHubGrpcClientOption

WithWorkItemListenerErrorHandler observes a terminal background listener failure after successful startup. Startup errors are returned directly by StartWorkItemListener; caller cancellation is not reported. The handler runs once after listener resources are canceled and before executor shutdown. It must return promptly. The handler is called without holding library locks.

func WithWorkItemMaxReceiveBytes added in v1.2.2

func WithWorkItemMaxReceiveBytes(maxBytes int) TaskHubGrpcClientOption

WithWorkItemMaxReceiveBytes sets the worker's per-message receive budget. A non-positive value keeps the default. This applies only to GetWorkItems; other RPC receive limits can be set on the supplied gRPC connection. Repeated ResourceExhausted receive errors stop the listener after bounded retries; WithWorkItemListenerErrorHandler can observe that terminal failure.

func WithWorkflowHistoryCacheMaxBytes

func WithWorkflowHistoryCacheMaxBytes(maxBytes int64) TaskHubGrpcClientOption

WithWorkflowHistoryCacheMaxBytes sets a budget, in bytes (serialized history size), for the worker's stateful-history cache across all instances on a stream. When exceeded, least-recently-used histories are evicted. A non-positive value means no byte limit (the cache is then bounded only by the instance count and TTL).

func WithWorkflowHistoryCacheMaxInstances

func WithWorkflowHistoryCacheMaxInstances(maxInstances int) TaskHubGrpcClientOption

WithWorkflowHistoryCacheMaxInstances sets the maximum number of per-instance histories the worker retains on a single stream. A non-positive value keeps the default.

func WithWorkflowHistoryCacheSweepInterval

func WithWorkflowHistoryCacheSweepInterval(interval time.Duration) TaskHubGrpcClientOption

WithWorkflowHistoryCacheSweepInterval sets how often the worker reclaims expired history cache entries. A non-positive value keeps the default.

func WithWorkflowHistoryCacheTTL

func WithWorkflowHistoryCacheTTL(ttl time.Duration) TaskHubGrpcClientOption

WithWorkflowHistoryCacheTTL sets how long an instance's history is retained in the worker's stateful-history cache after its last turn (sliding window). A non-positive value keeps the default.

Jump to

Keyboard shortcuts

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