Documentation
¶
Overview ¶
Package dtssample holds the Durable Task Scheduler setup that most runnable samples in this repository share: reading connection settings from the environment, opening a management client, and starting a worker against the same task hub.
Point the samples at a scheduler with a connection string, for example the local emulator:
export DTS_CONNECTION_STRING="Endpoint=http://localhost:8080;TaskHub=default;Authentication=None"
Index ¶
Constants ¶
const ConnectionStringVariable = "DTS_CONNECTION_STRING"
ConnectionStringVariable names the environment variable used by the connection-string-driven samples to locate their DTS task hub.
Variables ¶
This section is empty.
Functions ¶
func Cleanup ¶
func Cleanup(client *durabletaskscheduler.Client, instanceIDs ...api.InstanceID) error
Cleanup terminates and purges only the supplied, sample-owned instance IDs and their children. Call it before shutting down the worker. Entity state, schedules, export jobs, and storage objects need their own sample-specific cleanup.
func NewInstanceID ¶
func NewInstanceID(sample string) api.InstanceID
NewInstanceID gives each sample run its own orchestration namespace.
func Options ¶
func Options() (*durabletaskscheduler.Options, error)
Options builds scheduler options from ConnectionStringVariable.
func RequireCompleted ¶
func RequireCompleted(metadata *api.OrchestrationMetadata) error
RequireCompleted rejects unsuccessful terminal states as well as missing results.
Types ¶
type App ¶
type App struct {
// Client schedules orchestrations and reads their state.
Client *durabletaskscheduler.Client
// contains filtered or unexported fields
}
App owns a Durable Task Scheduler client and worker pair that are connected to the same task hub.
func Start ¶
func Start( ctx context.Context, registry *task.TaskRegistry, workerOptions ...durabletaskclient.TaskHubGrpcWorkerOption, ) (*App, error)
Start connects a client and starts a worker for registry against the task hub named by ConnectionStringVariable. The caller owns the returned App and must call App.Shutdown.
The worker derives its work-item filters from registry; pass additional workerOptions to layer more behavior on top.
func StartWithOptions ¶
func StartWithOptions( ctx context.Context, options *durabletaskscheduler.Options, registry *task.TaskRegistry, workerOptions ...durabletaskclient.TaskHubGrpcWorkerOption, ) (*App, error)
StartWithOptions is Start for a sample that customizes its options, such as enabling versioning or large payloads.