redis

package module
v2.0.0-...-03508dc Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: Apache-2.0 Imports: 9 Imported by: 1

README

Redis Broker

This is a basic implementation for a Redis broker that relies on the native pub/sub feature.

Note that broker protocol supports two features that Redis does not support. Subscribers of messages cannot acknowledge back to the Redis server that they received the message and was successfully processed. Thus, if an errors occurs the message will be lost.

The second limitation is that the Redis broker does not support the queue abstraction defined on the broker for distributing messages across subscribers that are apart of the same queue. This is because Redis is not a dedicated broker, but the pub/sub feature is simply a feature of the overall system.

Note that queues can be implemented in Redis, so this feature could theoretically be supported.

Documentation

Overview

Package redis provides a Redis broker

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultMaxActive      = 0
	DefaultMaxIdle        = 5
	DefaultIdleTimeout    = 2 * time.Minute
	DefaultConnectTimeout = 5 * time.Second
	DefaultReadTimeout    = 5 * time.Second
	DefaultWriteTimeout   = 5 * time.Second
)

Functions

func ConnectTimeout

func ConnectTimeout(d time.Duration) broker.Option

func IdleTimeout

func IdleTimeout(d time.Duration) broker.Option

func MaxActive

func MaxActive(n int) broker.Option

func MaxIdle

func MaxIdle(n int) broker.Option

func NewBroker

func NewBroker(opts ...broker.Option) broker.Broker

NewBroker returns a new broker implemented using the Redis pub/sub protocol. The connection address may be a fully qualified IANA address such as: redis://user:secret@localhost:6379/0?foo=bar&qux=baz

func ReadTimeout

func ReadTimeout(d time.Duration) broker.Option

func WriteTimeout

func WriteTimeout(d time.Duration) broker.Option

Types

This section is empty.

Jump to

Keyboard shortcuts

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