kafka

package
v0.0.0-...-805313b Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 6 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 the struct for handling Client connections and operations

func (*Client) Close

func (c *Client) Close()

Close closes all Client connections

func (*Client) PublishMessage

func (c *Client) PublishMessage(ctx context.Context, topic string, key, value []byte, options PublishOptions) error

PublishMessage sends a message to a specified Client topic

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, topic string, processMessage func(topic string, key, value []byte), options SubscriptionOptions) error

Subscribe subscribes to a specific Client topic

type Kafka

type Kafka interface {
	PublishMessage(ctx context.Context, topic string, key, value []byte, options PublishOptions) error
	Subscribe(ctx context.Context, topic string, processMessage func(topic string, key, value []byte), options SubscriptionOptions) error
}

func NewClient

func NewClient(logger logger.Logger, brokerAddress string) Kafka

NewClient initializes the Client with the broker address

type Message

type Message struct {
	Topic string
	Key   []byte
	Value []byte
}

Message is the struct for handling Kafka messages

type PublishOptions

type PublishOptions struct {
	Partition *int
}

PublishOptions is the struct for handling publish options

type SubscriptionOptions

type SubscriptionOptions struct {
	GroupID     *string
	Partition   *int
	StartOffset *int64
}

SubscriptionOptions is the struct for handling subscription options

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳