consumer

package
v0.0.0-...-f79bcc6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KafkaCfg

type KafkaCfg struct {
	Broker  []string `yaml:"broker"`
	GroupId string   `yaml:"groupId"`
}

type Scheduler

type Scheduler struct {
	BizCtx *biz.SampleBiz
	// contains filtered or unexported fields
}

func NewScheduler

func NewScheduler(logger *zap.SugaredLogger, conf KafkaCfg, bizCtx *biz.SampleBiz) (srv *Scheduler, err error)

func (*Scheduler) Name

func (s *Scheduler) Name() string

func (*Scheduler) Route

func (s *Scheduler) Route() (err error)

Route 在这里写路由

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context) (err error)

func (*Scheduler) Stop

func (s *Scheduler) Stop()

func (*Scheduler) Sub

func (s *Scheduler) Sub(topic string, handler kafka.Handler, workerCnt, bufSize int) (err error)

type Worker

type Worker struct {
	WorkerConfig
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(logger *zap.SugaredLogger, conf WorkerConfig, handleFunc kafka.Handler) (*Worker, error)

func (*Worker) RecvMsg

func (w *Worker) RecvMsg(ctx context.Context, msg kafka.Event) error

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) (err error)

Run FIXME 日志修改

func (*Worker) Stop

func (w *Worker) Stop()

type WorkerConfig

type WorkerConfig struct {
	KafkaCfg

	Topic       string `yaml:"topic"`
	BufSize     int    `yaml:"bufSize"`
	WorkerCount int    `yaml:"workerCount"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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