consumer

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package consumer defines functions for consuming messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer interface {
	Consume(globalCtx context.Context, handler MessageHandler) error
}

Consumer defines an interface for blocking action for listening for incoming events and invoking handler on each of them when Consumer returns, it is always one of Error defined values wrapped

type Error added in v1.0.1

type Error error
var ErrContextDone Error = errors.New("context is done")

type FirstToLastConsumer

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

func NewFirstToLastConsumer

func NewFirstToLastConsumer(consumerOffsetManager thead.Manager, commitReader, messageReader storage.MessageReader, config FirstToLastConsumerConfig,
	ipnsResolver ipns.Resolver) *FirstToLastConsumer

func (*FirstToLastConsumer) Consume

func (f *FirstToLastConsumer) Consume(globalCtx context.Context, handler MessageHandler) error

type FirstToLastConsumerConfig

type FirstToLastConsumerConfig struct {
	PollInterval time.Duration
	PollTimeout  time.Duration
	IPNSAddr     string
}

type MessageHandler

type MessageHandler interface {
	Handle(ctx context.Context, message storage.ProtoDecodable) error
}

MessageHandler is called to handle message found by Consumer. Handle on multiple messages can be called concurrently.

type MessageHandlerFunc added in v1.0.1

type MessageHandlerFunc func(ctx context.Context, message storage.ProtoDecodable) error

MessageHandlerFunc is a function implementing MessageHandler interface

func (MessageHandlerFunc) Handle added in v1.0.1

Handle calls MessageHandlerFunc

Jump to

Keyboard shortcuts

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