type

TypedTask

Compiled typed durable-task definition.

Properties

PropertyTypeDescription
TaskSlugfunc() stringReturns the stable registered task slug.
Enqueuefunc(context.Context, *App, Input, TaskEnqueueOptions) (TaskReceipt[Output], error)Validates and durably admits typed input.
Resultfunc(context.Context, *App, string) (TaskResult[Output], error)Loads and decodes typed task status and output.
Cancelfunc(context.Context, *App, string) errorPrevents queued work and fences a running attempt.

How it works

Only NewTask constructs a valid definition. Add it to Config.Tasks before using its runtime methods.

Full signature

type TypedTask[Input, Output any] struct { // contains filtered or unexported fields }

Source core/task.go:140

Methods

  • TypedTask.Cancel()

    Cancel atomically prevents a queued task from starting and fences a running attempt so its later heartbeat/completion cannot win.

  • TypedTask.Enqueue()

    Enqueue validates and durably stores typed input. The task must be the same slug/type contract registered in the running application's Config.Tasks.

  • TypedTask.Result()

    Result loads and decodes one task created by this typed definition.

  • TypedTask.TaskSlug()

    Public method TypedTask.TaskSlug from github.com/riducms/ridu/core.