Documentation ¶
Index ¶
- Constants
- type ConnParams
- type Kafka
- func (k *Kafka) Ack(msg *sarama.ConsumerMessage)
- func (k *Kafka) AddConsumer(topic string) (consumer *cluster.Consumer, err error)
- func (k *Kafka) Close()
- func (k *Kafka) Publish(topic string, body []byte, key string) (partition int32, offset int64, err error)
- func (k *Kafka) ResetOffset(topic string) error
- func (k *Kafka) ResetOffsetAppoint(topic string, partition int32, offset int64) error
- func (k *Kafka) Subscribe(consumer *cluster.Consumer) (message *sarama.ConsumerMessage, err error)
- type Msg
- type MsgCb
Constants ¶
View Source
const ( PubConn = "Publish" SubConn = "Subscribe" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnParams ¶
type Kafka ¶
type Kafka struct { Params *ConnParams Brokers []string ConnConfig *sarama.Config SubConfig *cluster.Config Pub sarama.SyncProducer Sub *cluster.Consumer }
func (*Kafka) AddConsumer ¶
func (*Kafka) Publish ¶
func (k *Kafka) Publish(topic string, body []byte, key string) (partition int32, offset int64, err error)
发布消息
func (*Kafka) ResetOffsetAppoint ¶
重置offset,指定分区和偏移量
Click to show internal directories.
Click to hide internal directories.