raw

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 8 Imported by: 0

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
}

Consumer wraps sarama's ConsumerGroup.

func NewConsumer

func NewConsumer(brokers, topic []string, groupName string, instanceId string) (*Consumer, error)

NewConsumer initializes a Consumer.

func (*Consumer) Close

func (c *Consumer) Close() error

Close terminates the Consumer.

func (*Consumer) GetMessage

func (c *Consumer) GetMessage() *shared.KafkaMessage

GetMessage receives a single message.

func (*Consumer) GetMessages

func (c *Consumer) GetMessages() chan *shared.KafkaMessage

GetMessages returns the message channel.

func (*Consumer) GetState

func (c *Consumer) GetState() ConsumerState

func (*Consumer) GetStats

func (c *Consumer) GetStats() (uint64, uint64)

GetStats returns marked and consumed message counts.

func (*Consumer) GetTopics

func (c *Consumer) GetTopics() []string

func (*Consumer) IsRunning

func (c *Consumer) IsRunning() bool

IsRunning returns the run state.

func (*Consumer) MarkMessage

func (c *Consumer) MarkMessage(msg *shared.KafkaMessage)

MarkMessage marks a message for commit.

func (*Consumer) MarkMessages

func (c *Consumer) MarkMessages(msgs []*shared.KafkaMessage)

MarkMessages marks multiple messages for commit.

func (*Consumer) Start

func (c *Consumer) Start(ctx context.Context) error

Start runs the Consumer.

type ConsumerState

type ConsumerState int
const (
	ConsumerStateUnknown ConsumerState = iota
	ConsumerStateEmpty
	ConsumerStateStable
	ConsumerStatePreparingRebalance
	ConsumerStateCompletingRebalance
	ConsumerStateDead
)

type GroupHandler

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

func (*GroupHandler) Cleanup

func (c *GroupHandler) Cleanup(session sarama.ConsumerGroupSession) error

func (*GroupHandler) ConsumeClaim

func (c *GroupHandler) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error

func (*GroupHandler) Setup

type TopicPartition

type TopicPartition struct {
	Topic     string
	Partition int32
}

Jump to

Keyboard shortcuts

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