redis

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBroker

func NewBroker(config Config) (broker.IBroker, error)

Types

type Broker

type Broker struct {
	*broker.Broker
	// contains filtered or unexported fields
}

func (*Broker) Send

func (b *Broker) Send(ctx context.Context, name string, value interface{}) error

func (*Broker) SendDelay

func (b *Broker) SendDelay(ctx context.Context, name string, value interface{}, delay time.Duration) error

func (*Broker) Worker

func (b *Broker) Worker() error

type Config

type Config struct {
	// URL be used to connect to Redis.
	// Scheme is required.
	// There are two connection types: by tcp socket and by unix socket.
	// Tcp connection:
	//		redis://<user>:<password>@<host>:<port>/<db_number>
	// Unix connection:
	//		unix://<user>:<password>@</path/to/redis.sock>?db=<db_number>
	URL   string
	Topic string
	// The maximum number of times the message is re-consumed. default 16 times.
	RetryMaxReconsume uint8
	//The Duration of backoff to apply between retries. default 2^retry*100ms
	RetryBackoff func(retry uint8) time.Duration
	// Custom codec
	Codec codec.Codec
	// Define the concurrency number of worker processes, default runtime.NumCPU()*2
	Concurrency int
	// A Logger represents an active logging object that generates lines of output to an io.Writer
	Logger log.ILogger
}

Jump to

Keyboard shortcuts

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