consumer

package
v0.0.0-...-2d91a92 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2019 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APP

type APP interface {
	ProcessTopic(topic, msg string, reqId int64) (maxRetryCnt int, err error)
	ProcessRetryFailure(topic, msg string, reqId int64) error
	ProcessDeadLetterTopic(topic, msg string, reqId int64) error
	Context() context.Context
	//for consumer goroutine to check exit
	CheckDone() bool
}

type Consumer

type Consumer struct {
	Ready chan bool
	// contains filtered or unexported fields
}

Consumer represents a Sarama consumer group consumer

func NewConsumer

func NewConsumer(brokers, group, topics string, app APP, wg *sync.WaitGroup) (*Consumer, sarama.ConsumerGroup)

func (*Consumer) Cleanup

func (consumer *Consumer) Cleanup(sess sarama.ConsumerGroupSession) error

Cleanup is run at the end of a session, once all ConsumeClaim goroutines have exited

func (*Consumer) ConsumeClaim

func (consumer *Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error

ConsumeClaim must start a consumer loop of ConsumerGroupClaim's Messages().

func (*Consumer) ProcessMessage

func (consumer *Consumer) ProcessMessage(topic, msg string)

message protocol: [topic type][retry count][reqID][req]

func (*Consumer) SetBuffer

func (consumer *Consumer) SetBuffer(buf chan []string)

This method used to set a buffer for consumer to put retry/dead letter/result message. structure of buffer member: [topic][reqID][message] message protocol: [topic type][retry count][reqID][req]

func (*Consumer) Setup

func (consumer *Consumer) Setup(sess sarama.ConsumerGroupSession) error

Setup is run at the beginning of a new session, before ConsumeClaim

Jump to

Keyboard shortcuts

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