type

TypedTask

A registered typed handle for durable admission, status, and cancellation.

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.

The handle slug/type contract must match the definition registered in the running application. HasOutput distinguishes a valid zero/null output from incomplete work.

Full signature

type TypedTask[Input, Output any] = core.TypedTask[Input, Output]

Source ridu.go:251

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.