redisdb

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 12 Imported by: 3

README

redisdb-stream

Run Testing codecov Go Report Card

Redis Streams as backend for Queue Package

System Flow

flow

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*options)

Option for queue system

func WithAddr

func WithAddr(addr string) Option

WithAddr setup the addr of redis

func WithBlockTime added in v0.0.3

func WithBlockTime(m time.Duration) Option

WithBlockTime setup the block time for publish messages we use the block command to make sure if no entry is found we wait until an entry is found

func WithCluster

func WithCluster() Option

WithCluster redis cluster

func WithConnectionString

func WithConnectionString(connectionString string) Option

WithConnectionString redis connection string

func WithConsumer

func WithConsumer(name string) Option

WithConsumer consumer name

func WithDB

func WithDB(db int) Option

WithPassword redis password

func WithGroup

func WithGroup(name string) Option

WithGroup group name

func WithLogger

func WithLogger(l queue.Logger) Option

WithLogger set custom logger

func WithMaxLength added in v0.0.3

func WithMaxLength(m int64) Option

WithMaxLength setup the max length for publish messages

func WithPassword

func WithPassword(passwd string) Option

WithPassword redis password

func WithRunFunc

func WithRunFunc(fn func(context.Context, core.TaskMessage) error) Option

WithRunFunc setup the run func of queue

func WithSkipTLSVerify added in v0.1.0

func WithSkipTLSVerify() Option

WithSkipTLSVerify returns an Option that configures the TLS settings to skip verification of the server's certificate. This is useful for connecting to servers with self-signed certificates or when certificate verification is not required. Use this option with caution as it makes the connection susceptible to man-in-the-middle attacks.

func WithStreamName

func WithStreamName(name string) Option

WithStreamName Stream name

func WithTLS added in v0.1.0

func WithTLS() Option

WithTLS returns an Option that configures the use of TLS for the connection. It sets the minimum TLS version to TLS 1.2.

func WithUsername added in v0.1.0

func WithUsername(username string) Option

WithUsername redis username This is only used for redis cluster

type Worker

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

Worker for Redis

func NewWorker

func NewWorker(opts ...Option) *Worker

NewWorker for struc

func (*Worker) Queue

func (w *Worker) Queue(task core.TaskMessage) error

Queue send notification to queue

func (*Worker) Request

func (w *Worker) Request() (core.TaskMessage, error)

Request a new task

func (*Worker) Run

func (w *Worker) Run(ctx context.Context, task core.TaskMessage) error

Run start the worker

func (*Worker) Shutdown

func (w *Worker) Shutdown() error

Shutdown worker

Jump to

Keyboard shortcuts

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