Documentation ¶
Index ¶
- func GetConnections() []*kafkaLib.Conn
- func GetReader() *kafkaLib.Reader
- func GetWriter() *kafkaLib.Writer
- func Init(conf Conf, topic, groupID string)
- func InitConnections(conf Conf)
- func InitReader(conf Conf, topic, groupID string)
- func InitWriter(conf Conf, topic string)
- func New(conf Conf, topic, groupID string) (connections []*kafkaLib.Conn, writer *kafkaLib.Writer, wErr error, ...)
- func NewConnections(conf Conf) []*kafkaLib.Conn
- func NewReader(conf Conf, topic, groupID string) (*kafkaLib.Reader, error)
- func NewWriter(conf Conf, topic string) (*kafkaLib.Writer, error)
- type Conf
- type Instance
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(conf Conf, topic, groupID string) (connections []*kafkaLib.Conn, writer *kafkaLib.Writer, wErr error, reader *kafkaLib.Reader, rErr error)
New 初始化连接
该方法会初始化连接、读实例、写实例
Types ¶
type Conf ¶
type Conf struct { Enable bool `yaml:"enable" toml:"enable" json:"enable" default:"false"` //是否启用 Endpoints []string `yaml:"endpoints" toml:"endpoints" json:"endpoints"` //地址列表,如: localhost:9092 SASLAuthType string `yaml:"SASLAuthType" toml:"SASLAuthType" json:"SASLAuthType"` //认证加密方式:plain、sha256、sha512 Username string `yaml:"username" toml:"username" json:"username"` //账号 Password string `yaml:"password" toml:"password" json:"password"` //密码 Timeout int `yaml:"timeout" toml:"timeout" json:"timeout"` //连接超时时间(毫秒)默认10000ms Tls *tls.Config `yaml:"-" toml:"-" json:"-"` //tls配置//tls配置 }
Click to show internal directories.
Click to hide internal directories.