Help us shape the future of Go! Take the 2026 Go Developer Survey

enqueuer

package
v0.19.1265 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnqueueSourceChannel = "channel"
	EnqueueSourceAwait   = "await"
	EnqueueSourceSweep   = "sweep"
)

EnqueueSource identifies how a signal was enqueued.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activities added in v0.19.919

type Activities struct {
	// contains filtered or unexported fields
}

Activities wraps the Enqueuer methods that should be registered as Temporal activities. This avoids exposing non-activity methods (e.g. Send) which would cause Temporal to panic on registration.

func NewActivities added in v0.19.919

func NewActivities(e *Enqueuer) *Activities

func (*Activities) Sweep added in v0.19.919

func (a *Activities) Sweep(ctx context.Context, _ *SweepRequest) (*SweepResponse, error)

@temporal-gen-v2 activity @start-to-close-timeout 5m

type Enqueuer

type Enqueuer struct {
	// contains filtered or unexported fields
}

Enqueuer processes signal enqueue requests in the background. It receives queue signal IDs via a channel and performs the UpdateWithStart call to enqueue them into their respective queue workflows. Up to maxWorkers signals are processed in parallel.

func New

func New(params Params) *Enqueuer

func (*Enqueuer) EnqueueInline added in v0.19.919

func (e *Enqueuer) EnqueueInline(ctx context.Context, queueSignalID string, source string) error

EnqueueInline synchronously enqueues a queue signal by performing the SignalWithStart call inline with the caller. It records enqueue timing metadata (including the enqueue source) and marks the signal as enqueued on success.

func (*Enqueuer) FullSweep added in v0.19.957

func (e *Enqueuer) FullSweep(ctx context.Context) (*FullSweepResponse, error)

FullSweep processes all unenqueued signals with no grace period or page cap. It is intended to be called from the admin dashboard to recover from large backlogs.

func (*Enqueuer) Send

func (e *Enqueuer) Send(queueSignalID string)

Send enqueues a queue signal ID for background processing. If the channel is full the ID is dropped — the AwaitSignal inline path will pick it up.

type FullSweepRequest added in v0.19.957

type FullSweepRequest struct{}

type FullSweepResponse added in v0.19.957

type FullSweepResponse struct {
	Enqueued   int   `json:"enqueued"`
	Errors     int   `json:"errors"`
	DurationMS int64 `json:"duration_ms"`
}

type Params

type Params struct {
	fx.In

	DB            *gorm.DB `name:"psql"`
	Cfg           *internal.Config
	TClient       temporalclient.Client
	L             *zap.Logger
	MW            metrics.Writer
	MeterProvider metric.MeterProvider `optional:"true"`
	LC            fx.Lifecycle
}

type SweepRequest added in v0.19.919

type SweepRequest struct{}

type SweepResponse added in v0.19.957

type SweepResponse struct {
	EnqueuedByType map[string]int `json:"enqueued_by_type"`
	TotalEnqueued  int            `json:"total_enqueued"`
	TotalErrors    int            `json:"total_errors"`
	DurationMS     int64          `json:"duration_ms"`
}

type SweepWorkflowRequest added in v0.19.919

type SweepWorkflowRequest struct{}

type Workflows added in v0.19.919

type Workflows struct{}

func NewWorkflows added in v0.19.919

func NewWorkflows() *Workflows

func (*Workflows) All added in v0.19.919

func (w *Workflows) All() []any

func (*Workflows) EnqueuerSweep added in v0.19.919

func (w *Workflows) EnqueuerSweep(ctx workflow.Context, req SweepWorkflowRequest) (*SweepResponse, error)

@temporal-gen-v2 workflow @task-queue "queue" @id-template enqueuer-sweep

Jump to

Keyboard shortcuts

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