Documentation ¶
Overview ¶
Package gkafka provides producer and consumer client for kafka server.
Kafka客户端.
Index ¶
- type Client
- func (client *Client) AsyncSend(message *Message) error
- func (client *Client) Close()
- func (client *Client) MarkOffset(topic string, partition int, offset int, metadata ...string) error
- func (client *Client) Receive() (*Message, error)
- func (client *Client) SyncSend(message *Message) error
- func (client *Client) Topics() ([]string, error)
- type Config
- type Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Config *Config // contains filtered or unexported fields }
Kafka Client(Consumer/SyncProducer/AsyncProducer)
func (*Client) MarkOffset ¶
标记指定topic 分区开始读取位置
func (*Client) Receive ¶
Receive message from kafka from specified topics in config, in BLOCKING way, gkafka will handle offset tracking automatically.
type Config ¶
type Config struct { GroupId string // group id for consumer. Servers string // server list, multiple servers joined by ','. Topics string // topic list, multiple topics joined by ','. AutoMarkOffset bool // auto mark message read after consumer message from server sarama.Config }
kafka Client based on sarama.Config
Click to show internal directories.
Click to hide internal directories.