Documentation ¶
Index ¶
- Constants
- func InitTopic(bootstrapUrl string, topics ...string) (err error)
- func InitTopicWithPartitionNumber(bootstrapUrl string, partitionNumber int, topics ...string) (err error)
- func NewConsumer(ctx context.Context, config Config, topic string, ...) error
- func NewMultiConsumer(ctx context.Context, config Config, topics []string, ...) (err error)
- type Config
- type KeySeparationBalancer
- type Message
- type Producer
- func NewProducer(ctx context.Context, config Config, topic string) (*Producer, error)
- func NewProducerWithBalancer(ctx context.Context, config Config, topic string, balancer kafka.Balancer) (*Producer, error)
- func NewProducerWithKeySeparationBalancer(ctx context.Context, config Config, topic string) (*Producer, error)
Constants ¶
View Source
const FirstOffset = kafka.FirstOffset
View Source
const LastOffset = kafka.LastOffset
Variables ¶
This section is empty.
Functions ¶
func NewConsumer ¶
Types ¶
type Config ¶
type Config struct { KafkaUrl string ConsumerGroup string //optional StartOffset int64 //defaults to FirstOffset Debug bool //defaults to false TimeNow func() time.Time //defaults to time.Now Wg *sync.WaitGroup //optional PartitionWatchInterval time.Duration //defaults to time.Minute OnError func(error) //defaults to log.Fatal }
type KeySeparationBalancer ¶
type KeySeparationBalancer struct { SubBalancer kafka.Balancer Seperator string }
func (*KeySeparationBalancer) Balance ¶
func (this *KeySeparationBalancer) Balance(msg kafka.Message, partitions ...int) (partition int)
type Producer ¶
type Producer struct {
// contains filtered or unexported fields
}
func NewProducer ¶
func NewProducerWithBalancer ¶
Click to show internal directories.
Click to hide internal directories.