callback

package
v0.19.978 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Send

func Send(ctx workflow.Context, l *zap.Logger, ref Ref, result Result)

Send signals the target workflow described by ref with the given result. Best-effort: if the target workflow has already terminated, the error is logged but not propagated.

func SignalName

func SignalName(id string) string

SignalName returns the deterministic signal name for a given id.

Types

type Ref

type Ref struct {
	WorkflowID string `json:"workflow_id,omitempty"`
	SignalName string `json:"signal_name,omitempty"`
	Namespace  string `json:"namespace,omitempty"`
}

Ref describes where to send a Temporal signal when an operation completes. It is stored as a JSONB column on QueueSignal and passed through the enqueue → handler → completion chain.

func New

func New(ctx workflow.Context, id string) Ref

New creates a Ref pointing back to the current workflow with a deterministic signal name derived from id. The caller should register the signal channel before the handler starts to avoid races.

func (Ref) GormDataType

func (Ref) GormDataType() string

GormDataType tells GORM to use the jsonb PostgreSQL type.

func (Ref) IsSet

func (c Ref) IsSet() bool

IsSet returns true if the callback has a target workflow.

func (*Ref) Scan

func (c *Ref) Scan(v interface{}) error

Scan implements database/sql.Scanner for reading JSONB from PostgreSQL.

func (Ref) Value

func (c Ref) Value() (driver.Value, error)

Value implements driver.Valuer for writing JSONB to PostgreSQL.

type Refs added in v0.19.978

type Refs []Ref

Refs is a slice of Ref with JSONB serialization for GORM. It replaces the single Callback field on QueueSignal to support multiple completion callbacks (e.g. from EnsureSignal).

func (*Refs) Add added in v0.19.978

func (r *Refs) Add(ref Ref)

Add appends a callback ref if it is set.

func (Refs) GormDataType added in v0.19.978

func (Refs) GormDataType() string

GormDataType tells GORM to use the jsonb PostgreSQL type.

func (Refs) IsSet added in v0.19.978

func (r Refs) IsSet() bool

IsSet returns true if there is at least one callback target.

func (*Refs) Scan added in v0.19.978

func (r *Refs) Scan(v interface{}) error

Scan implements database/sql.Scanner for reading JSONB from PostgreSQL.

func (Refs) Value added in v0.19.978

func (r Refs) Value() (driver.Value, error)

Value implements driver.Valuer for writing JSONB to PostgreSQL.

type Result

type Result struct {
	Status            string `json:"status"`
	StatusDescription string `json:"status_description,omitempty"`
}

Result is the payload sent by the handler on completion.

func Await

func Await(ctx workflow.Context, ref Ref) (*Result, error)

Await waits for a completion signal on the Ref's signal channel. Returns the Result on success, or an error if the signal failed or timed out.

Jump to

Keyboard shortcuts

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