kafka

package module
v2.0.0-...-44dd1c6 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Eventbus

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

func NewEventbus

func NewEventbus(opts ...Option) *Eventbus

func (*Eventbus) Close

func (eb *Eventbus) Close() error

Close 停止监听

func (*Eventbus) Publish

func (eb *Eventbus) Publish(ctx context.Context, topic string, payload interface{}) error

Publish 发布事件

func (*Eventbus) Subscribe

func (eb *Eventbus) Subscribe(_ context.Context, topic string, handler eventbus.EventHandler) error

Subscribe 订阅事件

func (*Eventbus) Unsubscribe

func (eb *Eventbus) Unsubscribe(_ context.Context, topic string, handler eventbus.EventHandler) error

Unsubscribe 取消订阅

type Option

type Option func(o *options)

func WithAddrs

func WithAddrs(addrs ...string) Option

WithAddrs 设置连接地址

func WithClient

func WithClient(client sarama.Client) Option

WithClient 设置外部客户端

func WithContext

func WithContext(ctx context.Context) Option

WithContext 设置上下文

func WithPrefix

func WithPrefix(prefix string) Option

WithPrefix 设置前缀

func WithVersion

func WithVersion(version string) Option

WithVersion 设置Kafka版本

Jump to

Keyboard shortcuts

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