Documentation
¶
Index ¶
- Variables
- type Config
- type Envelope
- type Handler
- type Priority
- type Queue
- func (q *Queue) DeadLetter() <-chan Envelope
- func (q *Queue) Enqueue(ctx context.Context, taskType string, payload any) error
- func (q *Queue) EnqueueAt(_ context.Context, taskType string, payload any, p Priority) error
- func (q *Queue) Register(taskType string, h Handler)
- func (q *Queue) Start(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrChannelFull = errors.New("channel full (backpressure)")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Name string
Workers int // per priority lane (Low gets half)
MaxAttempts int // default 5
BaseDelay time.Duration // exponential retry base, default 500ms
Logger *slog.Logger
}
Config controls queue behavior.
type Envelope ¶
type Envelope struct {
ID string `json:"id"`
Type string `json:"type"`
Payload json.RawMessage `json:"payload"`
Attempt int `json:"attempt"`
EnqueuedAt time.Time `json:"enqueued_at"`
}
Envelope is the data passed to handlers.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is the in‑process task queue.
func (*Queue) DeadLetter ¶
Click to show internal directories.
Click to hide internal directories.