kafka

package
v1.3.31 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUndefinedEntity is returned by the Push method of the [Client] when the
	// given entity name is unknown.
	ErrUndefinedEntity = errors.New("undefined entity")
	// ErrEmptyPayload is returned by the Push method of the [Client] when the
	// given payload is empty.
	ErrEmptyPayload = errors.New("payload can't be empty")
)

Functions

This section is empty.

Types

type Client

type Client struct {

	// Contains the mappings beetween the entity names and the corresponding
	// underlaying kafka topics.
	Topics map[string]string
	// contains filtered or unexported fields
}

Client implements an EventStreamClient using Kafka as the event stream system.

func NewClient

func NewClient(user string, password string, broker string, topics map[string]string) (Client, error)

NewClient creates a new Kafka client connected to the a broker using the given credentials and setting the mapping between all the entities and their corresponding topics.

func (*Client) Push

func (c *Client) Push(entity string, id string, payload []byte, metadata map[string][]byte) error

Push sends the payload of an entity, with the specified id, to corresponding topic according to the specified entity, using the kafka broker the client is connected to. The method waits until kafka confirms the message has been stored in the topic.

Jump to

Keyboard shortcuts

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