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 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 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
func (m MessageHandlerFunc) Handle(ctx context.Context, message storage.ProtoDecodable) error
Handle calls MessageHandlerFunc
Click to show internal directories.
Click to hide internal directories.