client

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a struct that holds the connection to the server

func NewClient

func NewClient(address, port string, tlsCfg *config.ClientTLSConfig) (*Client, error)

NewClient creates a new client It accepts an optional tlsCfg to enable mTLS. If tlsCfg is nil, it defaults to an insecure connection.

func (*Client) BulkRetrieve added in v1.0.2

func (c *Client) BulkRetrieve(topic string, startOffset int64, limit int32) (*pb.BulkRetrieveResponse, error)

BulkRetrieve retrieves a batch of messages from the server.

func (*Client) Close

func (c *Client) Close()

Close closes the connection to the server

func (*Client) Consume

func (c *Client) Consume(topic string, offset int64) ([]byte, int64, error)

Consume retrieves a message from the server

func (*Client) ConsumeEarliest

func (c *Client) ConsumeEarliest(topic string) ([]byte, int64, error)

func (*Client) ConsumeLatest

func (c *Client) ConsumeLatest(topic string) ([]byte, int64, error)

func (*Client) CreateTopic

func (c *Client) CreateTopic(topic string) error

CreateTopic creates a new topic on the server

func (*Client) DeleteUntilOffset

func (c *Client) DeleteUntilOffset(topic string, offset int64) error

DeleteUntilOffset deletes all messages in a topic until a certain offset

func (*Client) Produce

func (c *Client) Produce(topic string, message []byte) error

Produce sends a message to the server

func (*Client) StreamConsume

func (c *Client) StreamConsume(topic string, startOffset int64, function func([]byte, int64) error) error

func (*Client) StreamProduce

func (c *Client) StreamProduce(topic string, function func() ([]byte, error)) error

StreamProduce sends a stream of messages to the server

Jump to

Keyboard shortcuts

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