libs

module
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0

README

libs

🚀 Usage:

Install/Update Tools:

make update-tools

Run Modernize:

make modernize

Run CI Tasks:

make ci

queue

Work queue with single-worker delivery, priority + FIFO, delays, retries, and dead letter routing. Backends: inmem, sqlite, pgx (Postgres), redis.

import (
    "github.com/enverbisevac/libs/queue"
    "github.com/enverbisevac/libs/queue/inmem"
)

svc := inmem.New()
defer svc.Close(ctx)

cons, _ := svc.Subscribe(ctx, "emails", func(ctx context.Context, j *queue.Job) error {
    return sendEmail(j.Payload)
}, queue.WithConcurrency(4))
defer cons.Close()

_ = svc.Enqueue(ctx, "emails", []byte("hello@example.com"))

See queue/doc.go for the idempotency contract and docs/superpowers/specs/2026-04-08-queue-design.md for design rationale.

Directories

Path Synopsis
pgx
Package pgx provides a PostgreSQL implementation of cache.Cache.
Package pgx provides a PostgreSQL implementation of cache.Cache.
redis
Package redis provides a Redis implementation of cache.Cache.
Package redis provides a Redis implementation of cache.Cache.
Package httputil simplifies the decoding of HTTP requests (REST API) into Go structs for easier consumption.
Package httputil simplifies the decoding of HTTP requests (REST API) into Go structs for easier consumption.
internal
testdb
Package testdb starts ephemeral Postgres/Redis containers for integration tests.
Package testdb starts ephemeral Postgres/Redis containers for integration tests.
pgx
migrate
Package migrate dispatches outbox-table migrations to the right dialect based on a driver name string.
Package migrate dispatches outbox-table migrations to the right dialect based on a driver name string.
pgx
sql
Package sql provides shared building blocks for database/sql-based outbox.Store implementations.
Package sql provides shared building blocks for database/sql-based outbox.Store implementations.
sql/postgres
Package postgres provides a PostgreSQL implementation of outbox.Store using database/sql.
Package postgres provides a PostgreSQL implementation of outbox.Store using database/sql.
sql/sqlite
Package sqlite provides a SQLite implementation of outbox.Store using database/sql.
Package sqlite provides a SQLite implementation of outbox.Store using database/sql.
streambridge
Package streambridge adapts an outbox.Publisher to a libs stream.Service, so the libs Relay can drain the outbox into a stream broker without any project-specific glue.
Package streambridge adapts an outbox.Publisher to a libs stream.Service, so the libs Relay can drain the outbox into a stream broker without any project-specific glue.
pgx
Package queue provides a work queue with single-worker delivery semantics (competing consumers).
Package queue provides a work queue with single-worker delivery semantics (competing consumers).
inmem
Package inmem provides a non-durable, in-process queue.Service.
Package inmem provides a non-durable, in-process queue.Service.
pgx
Package pgx provides a durable queue.Service backed by PostgreSQL using jackc/pgx/v5.
Package pgx provides a durable queue.Service backed by PostgreSQL using jackc/pgx/v5.
queuetest
Package queuetest provides a backend-agnostic conformance test suite for queue.Service implementations and a deterministic FakeClock for use in backend-specific tests.
Package queuetest provides a backend-agnostic conformance test suite for queue.Service implementations and a deterministic FakeClock for use in backend-specific tests.
redis
Package redis provides a durable queue.Service backed by Redis.
Package redis provides a durable queue.Service backed by Redis.
sqlite
Package sqlite provides a durable, embedded queue.Service backed by SQLite.
Package sqlite provides a durable, embedded queue.Service backed by SQLite.
Package stream provides a Kafka/Redis-Streams-style durable event stream with consumer groups (shared work), at-least-once delivery, and replay.
Package stream provides a Kafka/Redis-Streams-style durable event stream with consumer groups (shared work), at-least-once delivery, and replay.
inmem
Package inmem provides an in-process stream.Service implementation for tests and single-process development.
Package inmem provides an in-process stream.Service implementation for tests and single-process development.
pgx
Package pgx provides a distributed stream.Service backed by Postgres.
Package pgx provides a distributed stream.Service backed by Postgres.
redis
Package redis provides a distributed stream.Service backed by Redis Streams.
Package redis provides a distributed stream.Service backed by Redis Streams.
sqlite
Package sqlite provides a durable, embedded stream.Service backed by SQLite.
Package sqlite provides a durable, embedded stream.Service backed by SQLite.
streamtest
Package streamtest provides a backend-agnostic conformance test suite for stream.Service implementations.
Package streamtest provides a backend-agnostic conformance test suite for stream.Service implementations.

Jump to

Keyboard shortcuts

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