Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger struct { LogConsumerSucc bool // contains filtered or unexported fields }
Logger ...
type MyConsumer ¶
type MyConsumer struct {
// contains filtered or unexported fields
}
MyConsumer ...
func NewConsumerGroup ¶
func NewConsumerGroup(brokers []string, topics []string, count int, groupName string) *MyConsumer
NewConsumerGroup 创建一个新的消费者组
func (*MyConsumer) Consumer ¶
func (c *MyConsumer) Consumer(fn func(msg *sarama.ConsumerMessage) error)
Consumer 开始消费
type MyProducter ¶
type MyProducter struct { Alias string `yaml:"alias"` Brokers []string `yaml:"brokers"` Sync bool `yaml:"sync"` WaitAck sarama.RequiredAcks `yaml:"wait_ack"` SuccLog bool `yaml:"succ_log"` Debug bool `yaml:"debug"` SyncProducter sarama.SyncProducer AsyncProducer sarama.AsyncProducer // contains filtered or unexported fields }
MyProducter ...
var ( // P default producter P *MyProducter // PS producter map PS map[string]*MyProducter )
func (*MyProducter) Publish ¶
func (p *MyProducter) Publish(topic, value string, key ...string) (partition int32, offset int64, err error)
Publish ... 发消息
func (*MyProducter) SetLogger ¶
func (p *MyProducter) SetLogger(logger *Logger)
SetLogger ... 使用自定的日志器
Click to show internal directories.
Click to hide internal directories.