Documentation ¶
Index ¶
- Variables
- type ClientPool
- type Factory
- type KafkaClient
- func (p *KafkaClient) Close() error
- func (p *KafkaClient) SendMsg(msg *sarama.ProducerMessage) error
- func (p *KafkaClient) SendMsgByByte(topic string, msg string) error
- func (p *KafkaClient) SendMsgByString(topic string, msg string) error
- func (p *KafkaClient) SendMsgs(msgs []*sarama.ProducerMessage) error
- type WrapClient
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrClosed = errors.New("pool is closed")
Functions ¶
This section is empty.
Types ¶
type ClientPool ¶
type ClientPool struct {
// contains filtered or unexported fields
}
func NewClientPool ¶
func NewClientPool(min, max int, factory Factory) (*ClientPool, error)
func (*ClientPool) Close ¶
func (c *ClientPool) Close()
func (*ClientPool) Get ¶
func (c *ClientPool) Get() (*WrapClient, error)
func (*ClientPool) Len ¶
func (c *ClientPool) Len() int
type Factory ¶
type Factory func() (*KafkaClient, error)
type KafkaClient ¶
type KafkaClient struct { sarama.SyncProducer Address string Timeout time.Duration // contains filtered or unexported fields }
func NewKafkaClient ¶
func (*KafkaClient) Close ¶
func (p *KafkaClient) Close() error
func (*KafkaClient) SendMsg ¶
func (p *KafkaClient) SendMsg(msg *sarama.ProducerMessage) error
func (*KafkaClient) SendMsgByByte ¶
func (p *KafkaClient) SendMsgByByte(topic string, msg string) error
func (*KafkaClient) SendMsgByString ¶
func (p *KafkaClient) SendMsgByString(topic string, msg string) error
func (*KafkaClient) SendMsgs ¶
func (p *KafkaClient) SendMsgs(msgs []*sarama.ProducerMessage) error
type WrapClient ¶
type WrapClient struct { *KafkaClient // contains filtered or unexported fields }
-----------------------------------------------------------------------------
func (*WrapClient) Close ¶
func (wc *WrapClient) Close() error
func (*WrapClient) MarkErr ¶
func (p *WrapClient) MarkErr()
Click to show internal directories.
Click to hide internal directories.