memqueue

package
v0.4.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package memqueue provides an in-memory implementation of workqueue.WorkQueue.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, opts ...Option) workqueue.WorkQueue

New returns a new in-memory WorkQueue.

Types

type Option

type Option func(*Queue)

Option configures the queue.

func WithWorkerPool

func WithWorkerPool(size int) Option

WithWorkerPool sets the number of worker goroutines for processing tasks. Default is 100 workers. Set to 0 to use unbounded goroutines.

type Queue

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

Queue is an in-memory implementation of WorkQueue.

func (*Queue) Enqueue

func (q *Queue) Enqueue(queue string, data any)

Enqueue sends a task to one queue subscriber.

func (*Queue) Shutdown

func (q *Queue) Shutdown(ctx context.Context) error

Shutdown closes the job channel and waits for all workers to finish.

func (*Queue) Subscribe

func (q *Queue) Subscribe(queue string, handler workqueue.Handler)

Subscribe registers a handler for queue tasks.

func (*Queue) Wait

func (q *Queue) Wait(ctx context.Context) error

Wait blocks until all pending tasks are processed.

Jump to

Keyboard shortcuts

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