kafka

package
v0.0.0-...-6ce5408 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

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 NewKafkaClient(address string, timeout time.Duration, isSuccess bool) (*KafkaClient, error)

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()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL