consumer

package
v0.0.0-...-c1f6a72 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

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

A Consumer consumes messages from a stream.

func New

func New(client *redis.Client, group, consumer string, options ...Option) *Consumer

New creates a new consumer.

func (*Consumer) Ack

func (c *Consumer) Ack(ctx context.Context, msgs ...Message) error

Ack acknowledges the messages.

func (*Consumer) Read

func (c *Consumer) Read(ctx context.Context) ([]Message, error)

Read reads messages from the stream.

type Message

type Message struct {
	Stream string
	ID     string
	Values map[string]interface{}
}

A Message is a consumed message from a redis stream.

type Option

type Option func(*config)

An Option modifies the config.

func WithBlock

func WithBlock(duration time.Duration) Option

WithBlock sets the block field of the config.

func WithCount

func WithCount(cnt int64) Option

WithCount sets the count for the config.

func WithNoAck

func WithNoAck(noAck bool) Option

WithNoAck sets the noAck field of the config.

func WithStream

func WithStream(stream string) Option

WithStream adds a stream to the consumer.

Jump to

Keyboard shortcuts

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