kafka

package
v0.0.0-...-f14b9eb Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartReceive

func StartReceive(r Reader, f func([]byte))

Types

type KafkaMsg

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

type KafkaStub

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

func NewKafkaStub

func NewKafkaStub(ctx context.Context, brokers []string) (k *KafkaStub, err error)

func (*KafkaStub) NewConsumerGroup

func (k *KafkaStub) NewConsumerGroup(ctx context.Context, groupName string, topics []string, f func([]byte))

func (*KafkaStub) SendMessageAsync

func (k *KafkaStub) SendMessageAsync(ctx context.Context, topic, content string)

type Message

type Message struct {
	Id        uint64 `json:"id"`
	Type      int    `json:"type"`
	Content   string `json:"content"`
	Timestamp int64  `json:"timestamp"`
}

type Reader

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

func (*Reader) Cleanup

func (consumer *Reader) Cleanup(sarama.ConsumerGroupSession) error

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

func (*Reader) ConsumeClaim

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

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

func (*Reader) Setup

func (consumer *Reader) Setup(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