redis

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBroker

func NewBroker(ctx context.Context, option ...Option) (pubsub.Broker, error)

NewBroker builds a new broker that uses redis streams as exchange mechanism.

This implementation is based on go-micro implementation: https://github.com/asim/go-micro

Types

type Logger

type Logger interface {
	Debugf(format string, v ...interface{})
	Infof(format string, v ...interface{})
	Warnf(format string, v ...interface{})
	Errorf(format string, v ...interface{})
}

Logger is the interface that provides methods to log messages.

type Option

type Option func(*options)

Option represents an option that can be passed to redis broker.

func WithAddress

func WithAddress(address string) Option

WithAddress sets the address of the redis server.

func WithDeliverTimeout

func WithDeliverTimeout(to time.Duration) Option

WithDeliverTimeout how long to wait trying to send a message to a handler until we consider it has timed out. Default: 10s.

func WithJanitorConsumerTimeout

func WithJanitorConsumerTimeout(janitorConsumerTimeout time.Duration) Option

WithJanitorConsumerTimeout threshold for an "old" consumer. Default: 1 day.

func WithJanitorFrequency

func WithJanitorFrequency(janitorFrequency time.Duration) Option

WithJanitorFrequency how often do we run the janitor. Default: 4 hour.

func WithLogger

func WithLogger(logger Logger) Option

WithLogger defines a logger for the broker. Default: noop logger.

func WithPendingIdleTime

func WithPendingIdleTime(pendingIdleTime time.Duration) Option

WithPendingIdleTime how long in pending before we claim a message from a different consumer. Default: 1 minute.

func WithReadGroupTimeout

func WithReadGroupTimeout(readGroupTimeout time.Duration) Option

WithReadGroupTimeout how long to block on call to redis. Default: 10s.

func WithTrimDuration

func WithTrimDuration(trimDuration time.Duration) Option

WithTrimDuration oldest event in stream. Default: 5 days.

Jump to

Keyboard shortcuts

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