Documentation
¶
Index ¶
- func InstallMiddleware(handle ...ProducerHandler)
- type Consumer
- type ConsumerConfig
- type ConsumerImpl
- type Msg
- func (msg *Msg) GetExecution() error
- func (msg *Msg) GetHeader() map[string]interface{}
- func (msg *Msg) GetMessageKey() string
- func (msg *Msg) IsStopped() bool
- func (msg *Msg) Next()
- func (msg *Msg) Publish() error
- func (msg *Msg) SetHeader(head map[string]interface{}) *Msg
- func (msg *Msg) SetMessageKey(key string) *Msg
- func (msg *Msg) Stop() *Msg
- type Producer
- type ProducerHandler
- type ProducerImpl
- type WorkerPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstallMiddleware ¶ added in v1.8.4
func InstallMiddleware(handle ...ProducerHandler)
InstallMiddleware Install the middleware.. You can control the publishing of messages by installing middleware.
Types ¶
type Consumer ¶
type Consumer interface {
// Start 使用配置结构体启动消费者
Start(config *ConsumerConfig)
// Restart the connection.
Restart() error
// Close the connection.
Close() error
}
Consumer Kafka Consumer interface definition.
func GetConsumer ¶ added in v1.8.8
func GetConsumer() Consumer
GetConsumer Returns the Consumer instance.
type ConsumerConfig ¶ added in v1.9.8
type ConsumerConfig struct {
// Kafka 服务器地址
Addrs []string
// 消费者组ID
GroupID string
// Sarama 配置
Config *sarama.Config
// 代理地址
ProxyAddr string
// 是否使用 H2C 代理
ProxyH2C bool
// HTTP 请求超时时间
RequestTimeout time.Duration
// 并发限制(并行模式下最大同时处理的消息数,默认500)
RateLimit int
// 优雅关闭超时时间(默认3秒)
CloseTimeout time.Duration
}
ConsumerConfig 消费者配置结构体
type ConsumerImpl ¶ added in v1.8.8
ConsumerImpl Kafka Consumer implementation.
func (*ConsumerImpl) Booting ¶ added in v1.8.8
func (c *ConsumerImpl) Booting(bootManager freedom.BootManager)
Booting The method of overriding the component . The single-case component initiates a callback.
func (*ConsumerImpl) Close ¶ added in v1.8.8
func (c *ConsumerImpl) Close() error
Close the connection.
func (*ConsumerImpl) Restart ¶ added in v1.8.8
func (c *ConsumerImpl) Restart() error
Restart the connection.
func (*ConsumerImpl) Start ¶ added in v1.8.8
func (c *ConsumerImpl) Start(config *ConsumerConfig)
Start
type Msg ¶
Msg Kafka Message.
func (*Msg) GetExecution ¶ added in v1.8.4
GetExecution Get the results of the execution .
func (*Msg) GetMessageKey ¶ added in v1.8.4
GetMessageKey Get kafka key.
func (*Msg) Next ¶ added in v1.8.4
func (msg *Msg) Next()
Next Perform the next step, typically for the control of middleware.
func (*Msg) SetMessageKey ¶ added in v1.8.4
SetMessageKey Set kafka key.
type Producer ¶
type Producer interface {
// Create a new message
NewMsg(topic string, content []byte) *Msg
// Start pass in the relevant address, configuration.
Start(addrs []string, config *sarama.Config)
// Restart the connection.
Restart() error
}
Producer The producer's interface definition.
func GetProducer ¶ added in v1.8.8
func GetProducer() Producer
GetProducer Gets an instance of the producer.
type ProducerHandler ¶ added in v1.8.4
type ProducerHandler func(*Msg)
ProducerHandler The function declaration of the Kafka Producer middleware..
type ProducerImpl ¶ added in v1.4.3
ProducerImpl The realization of the producer.
func (*ProducerImpl) Booting ¶ added in v1.4.3
func (pi *ProducerImpl) Booting(bootManager freedom.BootManager)
Booting The method of overriding the component . The single-case component initiates a callback.
func (*ProducerImpl) NewMsg ¶ added in v1.4.3
func (pi *ProducerImpl) NewMsg(topic string, content []byte) *Msg
NewMsg Create a new message.
func (*ProducerImpl) Restart ¶ added in v1.8.8
func (pi *ProducerImpl) Restart() error
Restart the connection.
type WorkerPool ¶ added in v1.9.11
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool