redis

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package redis provides a Redis adapter for Kiara.

Index

Constants

This section is empty.

Variables

View Source
var (
	// This error is reported via types.Pipe.Errors when the adapter can't deliver
	// succeeding messages arrived from Redis because types.Pipe.Delivered is already full.
	ErrSlowConsumer = errors.New("slow consumer")
)

Functions

This section is empty.

Types

type Adapter

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

Adapter is an adapter that sends message through Redis PubSub

func NewAdapter

func NewAdapter(client RedisClient, options ...Option) *Adapter

NewAdapter returns a new Adapter.

func (*Adapter) Start added in v0.2.0

func (a *Adapter) Start(pipe *types.Pipe)

func (*Adapter) Stop added in v0.2.0

func (a *Adapter) Stop()

func (*Adapter) Subscribe

func (a *Adapter) Subscribe(topic string) error

func (*Adapter) Unsubscribe

func (a *Adapter) Unsubscribe(topic string) error

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures the Adapter.

func PublishTimeout

func PublishTimeout(timeout time.Duration) Option

PublishTimeout sets the timeout for a publish request.

func SubscriptionTimeout

func SubscriptionTimeout(timeout time.Duration) Option

SubscriptionTimeout sets the timeout for a subscription request.

type RedisClient

type RedisClient interface {
	Publish(context.Context, string, interface{}) *redis.IntCmd
	Subscribe(context.Context, ...string) *redis.PubSub
	Close() error
}

RedisClient is an abstract interface for Redis client.

Jump to

Keyboard shortcuts

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