Documentation
¶
Index ¶
- Constants
- func ApplyInit(sig Signal, ctx workflow.Context) error
- func ApplyParams(sig Signal, params *Params)
- func ApplyRetryCount(sig Signal, retryIndex, groupRetryIndex int)
- func ApplyStepContext(sig Signal, stepID, flowID string)
- func AsSignalLifecycleHook(f any) any
- func HumanError(err error) string
- func RegisterUpdateHandlers(sig Signal, ctx workflow.Context) error
- type BeforePhaseDecision
- type CloneStepDef
- type Params
- type Raw
- type RunSignalLifecycleAfterPhaseRequest
- type RunSignalLifecycleBeforePhaseRequest
- type RunSignalLifecycleBeforePhaseResponse
- type Signal
- type SignalErrExecute
- type SignalErrInit
- type SignalErrPanic
- type SignalErrValidate
- type SignalLifecycleActivities
- func (a *SignalLifecycleActivities) RunSignalLifecycleAfterPhase(ctx context.Context, req *RunSignalLifecycleAfterPhaseRequest) error
- func (a *SignalLifecycleActivities) RunSignalLifecycleBeforePhase(ctx context.Context, req *RunSignalLifecycleBeforePhaseRequest) (*RunSignalLifecycleBeforePhaseResponse, error)
- type SignalLifecycleActivitiesParams
- type SignalLifecycleContext
- type SignalLifecycleHook
- type SignalPhase
- type SignalPhaseEvent
- type SignalPhaseOutcome
- type SignalStatus
- type SignalType
- type SignalWithAutoRetry
- type SignalWithCancel
- type SignalWithCloneSteps
- type SignalWithFetchSteps
- type SignalWithInit
- type SignalWithLifecycleContext
- type SignalWithMaxAutoRetries
- type SignalWithMaxRetries
- type SignalWithNoOpCheck
- type SignalWithOnApprove
- type SignalWithOnDeny
- type SignalWithOnRetry
- type SignalWithOnSkip
- type SignalWithParallelizable
- type SignalWithParams
- type SignalWithPolicyEvaluation
- type SignalWithQueue
- type SignalWithRetryCount
- type SignalWithRetryGroup
- type SignalWithSkipCleanup
- type SignalWithSkipGroup
- type SignalWithStepContext
- type SignalWithTimeout
- type SignalWithUpdateHandlers
- type SleepAfter
Constants ¶
const DefaultMaxRetries = 10
DefaultMaxRetries is the default maximum retry count for steps that don't implement SignalWithMaxRetries.
const DefaultSleepAfter = 1 * time.Minute
Variables ¶
This section is empty.
Functions ¶
func ApplyInit ¶ added in v0.19.872
ApplyInit checks if the signal implements SignalWithInit and calls Init if so.
func ApplyParams ¶ added in v0.19.872
ApplyParams checks if the signal implements signalWithParams and calls WithParams if so.
func ApplyRetryCount ¶ added in v0.19.894
ApplyRetryCount sets the retry count on signals that implement SignalWithRetryCount.
func ApplyStepContext ¶ added in v0.19.872
ApplyStepContext sets step context on signals that implement SignalWithStepContext.
func AsSignalLifecycleHook ¶ added in v0.19.894
func HumanError ¶ added in v0.19.901
HumanError extracts a clean, customer-facing error message from a Temporal error chain. Temporal wraps errors in layers of ActivityError, ChildWorkflowExecutionError, and ApplicationError — each prepending internal details (workflow IDs, event IDs, identity strings) that are meaningless to end users.
This function unwraps through those layers and returns the innermost ApplicationError message, which is the actual domain error set by signal code. If no ApplicationError is found, it falls back to the outermost error message.
Types ¶
type BeforePhaseDecision ¶ added in v0.19.894
type BeforePhaseDecision struct {
Allow bool `json:"allow"`
Reason string `json:"reason,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
func AllowPhaseDecision ¶ added in v0.19.894
func AllowPhaseDecision() BeforePhaseDecision
type CloneStepDef ¶ added in v0.19.894
type CloneStepDef struct {
Signal Signal
Name string
ExecutionType string // maps to app.WorkflowStepExecutionType (string to avoid importing app)
}
CloneStepDef describes a step to create when cloning a signal's step for retry.
type Params ¶ added in v0.19.872
type Params struct {
MW metrics.Writer
Cfg *internal.Config
V *validator.Validate
// QueueSignalID is the ID of the queue signal that this signal is associated with.
// This allows signals to reference their own queue signal record if needed.
QueueSignalID string
}
NOTE: we have a limited set of FX dependencies we can use in a signal, because they are built with signals and pass to and from workflows.
type Raw ¶ added in v0.19.894
type Raw struct {
// contains filtered or unexported fields
}
Raw is a signal envelope for enqueueing without importing the concrete signal package. The queue handler deserializes into the real registered type via the catalog at execution time.
func (*Raw) MarshalJSON ¶ added in v0.19.894
func (*Raw) Type ¶ added in v0.19.894
func (r *Raw) Type() SignalType
type RunSignalLifecycleAfterPhaseRequest ¶ added in v0.19.894
type RunSignalLifecycleAfterPhaseRequest struct {
Event SignalPhaseEvent `json:"event" validate:"required"`
Outcome SignalPhaseOutcome `json:"outcome" validate:"required"`
}
type RunSignalLifecycleBeforePhaseRequest ¶ added in v0.19.894
type RunSignalLifecycleBeforePhaseRequest struct {
Event SignalPhaseEvent `json:"event" validate:"required"`
}
type RunSignalLifecycleBeforePhaseResponse ¶ added in v0.19.894
type Signal ¶
type SignalErrExecute ¶ added in v0.19.872
type SignalErrExecute struct {
Err error
}
SignalErrExecute wraps an error that occurred during signal execution.
func (*SignalErrExecute) Error ¶ added in v0.19.872
func (e *SignalErrExecute) Error() string
func (*SignalErrExecute) Unwrap ¶ added in v0.19.872
func (e *SignalErrExecute) Unwrap() error
type SignalErrInit ¶ added in v0.19.872
type SignalErrInit struct {
Err error
}
SignalErrInit wraps an error that occurred during signal initialization.
func (*SignalErrInit) Error ¶ added in v0.19.872
func (e *SignalErrInit) Error() string
func (*SignalErrInit) Unwrap ¶ added in v0.19.872
func (e *SignalErrInit) Unwrap() error
type SignalErrPanic ¶ added in v0.19.872
type SignalErrPanic struct {
Value any
Phase string // "init", "validate", or "execute"
StackTrace string
}
SignalErrPanic wraps a panic that occurred during signal processing.
func NewSignalErrPanic ¶ added in v0.19.894
func NewSignalErrPanic(value any, phase string) *SignalErrPanic
func (*SignalErrPanic) Error ¶ added in v0.19.872
func (e *SignalErrPanic) Error() string
type SignalErrValidate ¶ added in v0.19.872
type SignalErrValidate struct {
Err error
}
SignalErrValidate wraps an error that occurred during signal validation.
func (*SignalErrValidate) Error ¶ added in v0.19.872
func (e *SignalErrValidate) Error() string
func (*SignalErrValidate) Unwrap ¶ added in v0.19.872
func (e *SignalErrValidate) Unwrap() error
type SignalLifecycleActivities ¶ added in v0.19.894
type SignalLifecycleActivities struct {
// contains filtered or unexported fields
}
func NewSignalLifecycleActivities ¶ added in v0.19.894
func NewSignalLifecycleActivities(params SignalLifecycleActivitiesParams) *SignalLifecycleActivities
func (*SignalLifecycleActivities) RunSignalLifecycleAfterPhase ¶ added in v0.19.894
func (a *SignalLifecycleActivities) RunSignalLifecycleAfterPhase(ctx context.Context, req *RunSignalLifecycleAfterPhaseRequest) error
@temporal-gen-v2 activity @start-to-close-timeout 30s
func (*SignalLifecycleActivities) RunSignalLifecycleBeforePhase ¶ added in v0.19.894
func (a *SignalLifecycleActivities) RunSignalLifecycleBeforePhase(ctx context.Context, req *RunSignalLifecycleBeforePhaseRequest) (*RunSignalLifecycleBeforePhaseResponse, error)
@temporal-gen-v2 activity @start-to-close-timeout 30s
type SignalLifecycleActivitiesParams ¶ added in v0.19.894
type SignalLifecycleActivitiesParams struct {
fx.In
Hooks []SignalLifecycleHook `group:"signal_lifecycle_hooks"`
}
type SignalLifecycleContext ¶ added in v0.19.894
type SignalLifecycleHook ¶ added in v0.19.894
type SignalLifecycleHook interface {
Name() string
Supports(event SignalPhaseEvent) bool
BeforePhase(ctx context.Context, event SignalPhaseEvent) (BeforePhaseDecision, error)
AfterPhase(ctx context.Context, event SignalPhaseEvent, outcome SignalPhaseOutcome) error
}
type SignalPhase ¶ added in v0.19.894
type SignalPhase string
const ( SignalPhaseValidate SignalPhase = "validate" SignalPhaseExecute SignalPhase = "execute" SignalPhaseCancel SignalPhase = "cancel" )
type SignalPhaseEvent ¶ added in v0.19.894
type SignalPhaseEvent struct {
QueueSignalID string `json:"queue_signal_id"`
QueueID string `json:"queue_id"`
SignalType SignalType `json:"signal_type"`
OrgID string `json:"org_id"`
Phase SignalPhase `json:"phase"`
InstallID *string `json:"install_id,omitempty"`
ComponentID *string `json:"component_id,omitempty"`
SandboxID *string `json:"sandbox_id,omitempty"`
Operation string `json:"operation,omitempty"`
Stage string `json:"stage,omitempty"`
}
type SignalPhaseOutcome ¶ added in v0.19.894
type SignalStatus ¶ added in v0.19.894
type SignalStatus string
SignalStatus mirrors app.Status to avoid an import cycle between signal and app.
const ( SignalStatusSuccess SignalStatus = "success" SignalStatusError SignalStatus = "error" SignalStatusCancelled SignalStatus = "cancelled" )
type SignalType ¶
type SignalType string
type SignalWithAutoRetry ¶ added in v0.19.894
type SignalWithAutoRetry interface {
AutoRetry() bool
}
SignalWithAutoRetry is implemented by signals that should automatically retry on failure without requiring user intervention. The conductor checks this after a step error and triggers a retry if the retry budget hasn't been exhausted.
type SignalWithCancel ¶ added in v0.19.872
SignalWithCancel is an optional interface that signals can implement to provide custom cancellation cleanup logic.
type SignalWithCloneSteps ¶ added in v0.19.894
type SignalWithCloneSteps interface {
CloneSteps(originalStepName string) []CloneStepDef
}
SignalWithCloneSteps is implemented by signals whose steps require prerequisite steps when retried. For example, an apply signal may return a plan step + apply step so that retrying an apply re-runs the plan first.
type SignalWithFetchSteps ¶ added in v0.19.894
type SignalWithFetchSteps interface {
Signal
SignalWithUpdateHandlers
}
SignalWithFetchSteps marks a signal as a step generator. The signal must register a "FetchSteps" update handler that returns workflow steps. The conductor enqueues the signal, sends the "FetchSteps" update, and uses the returned steps instead of the hardcoded Generators map.
type SignalWithInit ¶ added in v0.19.872
SignalWithInit is an optional interface that signals can implement to perform initialization after params have been applied but before validate/execute are called.
type SignalWithLifecycleContext ¶ added in v0.19.894
type SignalWithLifecycleContext interface {
Signal
LifecycleContext() SignalLifecycleContext
}
SignalWithLifecycleContext is an optional interface that signals can implement to provide rich context for lifecycle hook events.
type SignalWithMaxAutoRetries ¶ added in v0.19.894
SignalWithMaxAutoRetries is implemented by signals that want a separate limit for automatic retries (as opposed to user-initiated manual retries). When auto-retries are exhausted the step is marked as failed, but the user can still manually retry up to MaxRetries(). If not implemented, all retries up to MaxRetries() are automatic.
Accepts workflow.Context so implementations can fetch configuration dynamically (e.g., from the component config) rather than baking values into the signal at step creation time.
type SignalWithMaxRetries ¶ added in v0.19.894
type SignalWithMaxRetries interface {
MaxRetries() int
}
SignalWithMaxRetries is implemented by signals that declare a custom maximum retry count. If not implemented, the default max retry count (DefaultMaxRetries) is used. This is the global ceiling for retries — when exhausted, no more retries of any kind.
type SignalWithNoOpCheck ¶ added in v0.19.894
type SignalWithNoOpCheck interface {
IsNoOpCheckable() bool
}
SignalWithNoOpCheck is implemented by approval-type signals whose plan can have zero changes (noop). When the conductor detects a noop plan, it auto-skips both the approval step and its paired apply step.
type SignalWithOnApprove ¶ added in v0.19.894
SignalWithOnApprove is called when an approval step receives an "approve" response. Signals can implement this to perform side effects after approval is granted.
type SignalWithOnDeny ¶ added in v0.19.894
SignalWithOnDeny is called when an approval step receives a "deny" response. Signals can implement this to perform cleanup when approval is denied.
type SignalWithOnRetry ¶ added in v0.19.894
SignalWithOnRetry is called when an approval step receives a "retry plan" response. Signals can implement this to perform cleanup or preparation before the retry clone is created.
type SignalWithOnSkip ¶ added in v0.19.894
SignalWithOnSkip is called when an approval step receives a "skip" response (either skip-current or skip-current-and-dependents). Distinct from SignalWithSkipCleanup.OnSkipped which is called by the conductor when programmatically skipping a step.
type SignalWithParallelizable ¶ added in v0.19.894
type SignalWithParallelizable interface {
IsParallelizable() bool
}
SignalWithParallelizable is implemented by signals whose steps can execute in parallel with other steps in the same group. By default, steps within a group execute sequentially. When true, the conductor may dispatch multiple steps concurrently.
type SignalWithParams ¶ added in v0.19.872
type SignalWithPolicyEvaluation ¶ added in v0.19.894
type SignalWithPolicyEvaluation interface {
RequiresPolicyEvaluation() bool
}
SignalWithPolicyEvaluation is implemented by signals whose steps require policy evaluation before the approval proceeds. The conductor runs policy checks only when this interface is present and returns true.
type SignalWithQueue ¶ added in v0.19.894
type SignalWithQueue interface {
Queue() string
}
SignalWithQueue is implemented by signals that target a specific workflow queue instead of the conductor's default target queue. The conductor reads this to route the inner signal to the correct queue.
type SignalWithRetryCount ¶ added in v0.19.894
type SignalWithRetryCount interface {
SetRetryCount(retryIndex, groupRetryIndex int)
}
SignalWithRetryCount is implemented by signals that need to know their retry index at execution time. When a step is executed, the conductor calls SetRetryCount with the step's RetryIndex and GroupRetryIdx before Execute().
type SignalWithRetryGroup ¶ added in v0.19.894
type SignalWithRetryGroup interface {
RetryGroup() bool
}
SignalWithRetryGroup is implemented by signals whose steps should retry as an entire group. When a retry is triggered for a step whose signal returns RetryGroup() == true, ALL steps sharing the same GroupIdx are cloned and re-executed, not just the individual step.
Mutually exclusive with parallel group execution — when a group has Parallel=true, RetryGroup is not supported and individual step retries are used instead.
type SignalWithSkipCleanup ¶ added in v0.19.894
SignalWithSkipCleanup is implemented by signals that need to perform cleanup when their step is skipped or denied with "skip dependents". For example, sandbox plan signals mark all component deploy steps as skipped. The conductor calls OnSkipped after marking the step itself.
type SignalWithSkipGroup ¶ added in v0.19.894
type SignalWithSkipGroup interface {
SkipGroup() bool
}
SignalWithSkipGroup is implemented by signals that want a "skip" approval response to skip the entire remaining group (DirectiveSkipGroup). When not implemented or when SkipGroup() returns false, a skip response only skips the current step and continues to the next step in the group (DirectiveContinue).
type SignalWithStepContext ¶ added in v0.19.872
SignalWithStepContext is implemented by signals that need the workflow step ID and flow ID injected at step generation time, before the step is persisted to the database.
type SignalWithTimeout ¶ added in v0.19.903
SignalWithTimeout is implemented by signals that need a custom execution timeout. The returned duration is used as the ScheduleToCloseTimeout for the execute activity in the queue dispatcher. If not implemented, the default (2 hours) is used.
type SignalWithUpdateHandlers ¶ added in v0.19.894
type SignalWithUpdateHandlers interface {
Signal
RegisterUpdateHandlers(ctx workflow.Context) error
}
SignalWithUpdateHandlers is an optional interface that signals can implement to register custom Temporal update handlers on the handler workflow. Called after initializeState() but before the handler is marked ready, so handlers are available for the entire lifecycle of the signal.
type SleepAfter ¶ added in v0.19.894
SleepAfter is an optional interface that signals can implement to control how long the handler workflow stays alive after execution. This grace period allows subsequent signals to reuse the running workflow via update-with-start instead of starting a new one. Defaults to 1 minute if not implemented. Return 0 to terminate the handler workflow immediately after execution.