Documentation
¶
Index ¶
- Variables
- func CreateTopic(brokerAddr string, topic string, NumPartitions, ReplicationFactor int) error
- func ListTopics(brokerAddr string) ([]string, error)
- type Alarm
- type Consumer
- type FileRecover
- type KeyHashPartitionRule
- type Message
- type PartitionRule
- type Producer
- type ProducerRecover
- type RestoreFunc
- type RoundRobinPartitionRule
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorPaused = errors.New("paused")
Functions ¶
func CreateTopic ¶
use when auto.create.topics.enable='false'
Types ¶
type Consumer ¶
type Consumer struct { }
由于kafka是持久化和基于消费position的可回溯消费,因此consumer端无需再过度封装。 无论是低层api还是高层api,基于pattition或是组消费,kafka-go已经做得足够好。 特此说明。
type FileRecover ¶
type FileRecover struct {
// contains filtered or unexported fields
}
func NewFileRecover ¶
func NewFileRecover(topic, savePath string, bufCap int, writeFileIntervalSecond int) (*FileRecover, error)
func (*FileRecover) CloseNotify ¶
func (m *FileRecover) CloseNotify() chan struct{}
func (*FileRecover) Restore ¶
func (m *FileRecover) Restore(fn RestoreFunc)
func (*FileRecover) Save ¶
func (m *FileRecover) Save(message Message) error
type KeyHashPartitionRule ¶
type KeyHashPartitionRule struct {
PartitionNum int
}
type PartitionRule ¶
type Producer ¶
type Producer struct {
// contains filtered or unexported fields
}
func NewProducer ¶
func NewProducer(topic string, partitionRule PartitionRule, alarm Alarm, recover ProducerRecover, brokerAddrList []string) *Producer
func (*Producer) PublishMessage ¶
type ProducerRecover ¶
type ProducerRecover interface { Save(message Message) error Restore(fn RestoreFunc) CloseNotify() chan struct{} }
type RestoreFunc ¶
Click to show internal directories.
Click to hide internal directories.