Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) Close() error
- func (c *Client) Consume(topic string, id int64, limit int) (io.ReadCloser, []int64, error)
- func (c *Client) ConsumeMsgs(topic string, id int64, limit int) ([][]byte, error)
- func (c *Client) CreateTopic(topic string) error
- func (c *Client) DeleteTopic(topic string) error
- func (c *Client) ListTopics(regex string) ([]string, error)
- func (c *Client) NewWriter(topic string, delimiter []byte) io.Writer
- func (c *Client) Produce(topic string, sizes []int64, r io.Reader) error
- func (c *Client) ProduceMsgs(topic string, msgs ...[]byte) error
- func (c *Client) WatchTopics(ctx context.Context, topics []string, ch chan<- string) error
- type Option
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ( ErrTopicAlreadyExists = headers.ErrTopicAlreadyExists ErrNoContent = headers.ErrNoContent ErrInvalidTopic = headers.ErrInvalidTopic )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a lightweight client around the haraqa http api, use NewClient() to create a new client
func NewClient ¶
NewClient creates a new client instance. Any options given override the local defaults
func (*Client) Consume ¶
Consume reads messages off of a topic starting from id, no more than the given limit is returned. If limit is less than 1, the server sets the limit.
func (*Client) ConsumeMsgs ¶
ConsumeMsgs reads messages off of a topic starting from id, no more than the given limit is returned. If limit is less than 1, the server sets the limit.
func (*Client) CreateTopic ¶
CreateTopic Creates a new topic. It returns an error if the topic already exists
func (*Client) DeleteTopic ¶
DeleteTopic Delete a topic
func (*Client) ListTopics ¶
ListTopics Lists all topics, filter by prefix, suffix, and/or a regex expression
func (*Client) ProduceMsgs ¶
ProduceMsgs sends the messages to the designated topic
func (*Client) WatchTopics ¶
WatchTopics opens a websocket to the server to listen for changes to the given topics. It writes the name of any modified topics to the given channel until a context cancellation or an error occurs
type Option ¶
Option represents a optional function argument to NewClient
func WithConsumerGroup ¶
func WithHTTPClient ¶
WithHTTPClient replaces the default http client config when calling NewClient