queue

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package queue defines the platform work-queue contract and its outbox-backed implementation.

Index

Constants

This section is empty.

Variables

Module provides the outbox-backed queue as the Queue contract.

Functions

This section is empty.

Types

type OutboxQueue

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

OutboxQueue implements Queue by reusing the outbox publisher: a Task has the same Subject()/Version() shape as an OutboxEvent, so the outbox row layout already fits. The relay routes by subject (events.* vs queue.*) to the appropriate JetStream stream.

func NewOutboxQueue

func NewOutboxQueue(publisher outbox.Outbox) *OutboxQueue

func (*OutboxQueue) Enqueue

func (q *OutboxQueue) Enqueue(ctx context.Context, t Task) error

Enqueue stages a task for at-least-once, single-consumer execution. MUST be called inside a UnitOfWork transaction so the outbox row write is atomic with the aggregate state change that triggered the enqueue.

type Queue

type Queue interface {
	Enqueue(ctx context.Context, t Task) error
}

Queue enqueues tasks for asynchronous execution.

type Task

type Task interface {
	Subject() string
	Version() string
}

Task is the constraint for queueable point-to-point work units. Each task type declares its own subject and schema version. Tasks are imperative ("validate-asset"), single-consumer, and live on the work-queue stream.

Jump to

Keyboard shortcuts

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