Documentation
¶
Index ¶
- func RandStringBytes(n int) string
- type Client
- func (k *Client) Close() error
- func (k *Client) CreateTopic(topic string, numPart int)
- func (k *Client) HealthCheckBroker()
- func (k *Client) IsReaderConnected() bool
- func (k *Client) IsWriters() bool
- func (k *Client) ListTopics()
- func (k *Client) ListTopics2()
- func (k *Client) Listen(ctx context.Context, cMgs chan *Message) error
- func (k *Client) ListenWithAutoCommit(ctx context.Context, cMgs chan *Message) error
- func (k *Client) NewConsumer(consumerGroup string, topics []string)
- func (k *Client) NewPublisher() error
- func (k *Client) Publish(ctx context.Context, topic string, msg interface{}) error
- func (k *Client) SetAddrs(addrs []string)
- type IClient
- type Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandStringBytes ¶ added in v2.0.5
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateTopic ¶ added in v2.0.5
func (*Client) HealthCheckBroker ¶ added in v2.0.3
func (k *Client) HealthCheckBroker()
func (*Client) IsReaderConnected ¶ added in v2.0.3
func (*Client) ListTopics ¶
func (k *Client) ListTopics()
func (*Client) ListTopics2 ¶ added in v2.0.5
func (k *Client) ListTopics2()
func (*Client) Listen ¶ added in v2.0.3
Listen manual listen need call msg.Commit() when process done recommend for this process
func (*Client) ListenWithAutoCommit ¶ added in v2.0.3
ListenWithAutoCommit autocommit when message delivered not recommend use this function
func (*Client) NewConsumer ¶ added in v2.0.3
func (*Client) NewPublisher ¶ added in v2.0.3
type IClient ¶
type IClient interface { SetAddrs(addrs []string) Listen(ctx context.Context, cMgs chan *Message) error ListenWithAutoCommit(ctx context.Context, cMgs chan *Message) error NewConsumer(consumerGroup string, topics []string) IsWriters() bool Close() error NewPublisher() error Publish(ctx context.Context, topic string, msg interface{}) error IsReaderConnected() bool }
type Message ¶
type Message struct { Offset int64 `json:"offset,omitempty"` Partition int `json:"partition,omitempty"` Topic string `json:"topic,omitempty"` Key string `json:"key,omitempty"` Body []byte `json:"body,omitempty"` Timestamp int64 `json:"timestamp,omitempty"` ConsumerGroup string `json:"consumer_group,omitempty"` Commit func() Headers map[string]string }
Message define message encode/decode sarama message
Click to show internal directories.
Click to hide internal directories.