Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper handle for rd_kafka_t
func NewProducer ¶
func NewProducer(config Config, handler MessageDelivery) (*Client, error)
NewProducer creates a new librdkafka client in producer mode. Make sure to call Close() when done.
func (*Client) GetAllocCounter ¶
GetAllocCounter returns the number of allocated native buffers
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a wrapper for rd_kafka_conf_t
func NewConfig ¶
func NewConfig() Config
NewConfig creates a new main config wrapper. Make sure to call Close() when done.
func (*Config) SetB ¶
SetB sets a boolean value in this config
type ErrorHandle ¶
type ErrorHandle struct {
// contains filtered or unexported fields
}
ErrorHandle is a convenience wrapper for handling librdkafka native errors. This struct fulfills the standard golang error interface.
func (*ErrorHandle) Error ¶
func (l *ErrorHandle) Error() string
type Message ¶
Message is the interface used to send exchange data with kafka
type MessageDelivery ¶
type MessageDelivery interface { OnMessageError(reason string, userdata []byte) OnMessageDelivered(userdata []byte) }
MessageDelivery is used to handle message delivery errors
type ResponseError ¶
ResponseError is used as a wrapper for errors generated by the batch producer. The Code member wraps directly to the librdkafka error number. The original message is attached to allow backtracking.
func (ResponseError) Error ¶
func (r ResponseError) Error() string
type Topic ¶
type Topic struct {
// contains filtered or unexported fields
}
Topic wrapper handle for rd_kafka_topic_t
func NewTopic ¶
func NewTopic(name string, config TopicConfig, client *Client) *Topic
NewTopic creates a new topic representation in librdkafka. You have to call Close() to free any internal state. As this struct holds a pointer to the client make sure that Client.Close is called after closing objects of this type.
type TopicConfig ¶
type TopicConfig struct {
// contains filtered or unexported fields
}
TopicConfig is a wrapper for rd_kafka_topic_conf_t
func NewTopicConfig ¶
func NewTopicConfig() TopicConfig
NewTopicConfig creates a new topic config wrapper. Make sure to call Close() when done.
func (*TopicConfig) Set ¶
func (c *TopicConfig) Set(key, value string)
Set sets a string value in this config
func (*TopicConfig) SetB ¶
func (c *TopicConfig) SetB(key string, value bool)
SetB sets a boolean value in this config
func (*TopicConfig) SetI ¶
func (c *TopicConfig) SetI(key string, value int)
SetI sets an integer value in this config
func (*TopicConfig) SetRandomPartitioner ¶
func (c *TopicConfig) SetRandomPartitioner()
SetRandomPartitioner registers the random partitioner function.
func (*TopicConfig) SetRoundRobinPartitioner ¶
func (c *TopicConfig) SetRoundRobinPartitioner()
SetRoundRobinPartitioner registers the round robin partitioner function.