kafka

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBatchSize = 1
)
View Source
const (
	RetryReadInterval = 5 * time.Second
)

Variables

This section is empty.

Functions

func Read

func Read(opts *cli.Options) error

Read is the entry point function for performing read operations in Kafka.

This is where we verify that the provided arguments and flag combination makes sense/are valid; this is also where we will perform our initial conn.

func Relay added in v0.4.0

func Relay(opts *cli.Options) error

Relay sets up a new Kafka relayer, starts GRPC workers and the API server

func Write

func Write(opts *cli.Options) error

Write is the entry point function for performing write operations in Kafka.

This is where we verify that the passed args and flags combo makes sense, attempt to establish a connection, parse protobuf before finally attempting to perform the write.

Types

type IKafkaRelayer added in v0.10.0

type IKafkaRelayer interface {
	Relay() error
}

type Kafka

type Kafka struct {
	Id      string
	Reader  *skafka.Reader
	Writer  *skafka.Writer
	Options *cli.Options
	MsgDesc *desc.MessageDescriptor
	// contains filtered or unexported fields
}

Kafka holds all attributes required for performing a write to Kafka. This struct should be instantiated via the kafka.Read(..) func.

func (*Kafka) Read added in v0.1.0

func (k *Kafka) Read() error

Read will attempt to consume one or more messages from a given topic, optionally decode it and/or convert the returned output.

This method SHOULD be able to recover from network hiccups.

func (*Kafka) Write added in v0.1.0

func (k *Kafka) Write(key, value []byte) error

Write writes a message to a kafka topic. It is a wrapper for WriteMessages.

type KafkaReader added in v0.8.1

type KafkaReader struct {
	Reader *skafka.Reader
	Conn   *skafka.Conn
}

func NewReader added in v0.1.0

func NewReader(opts *cli.Options) (*KafkaReader, error)

type KafkaWriter added in v0.8.1

type KafkaWriter struct {
	Writer *skafka.Writer
	Conn   *skafka.Conn
}

func NewWriter added in v0.1.0

func NewWriter(opts *cli.Options) (*KafkaWriter, error)

type Relayer added in v0.10.0

type Relayer struct {
	Options *cli.Options
	MsgDesc *desc.MessageDescriptor
	RelayCh chan interface{}

	Looper         *director.FreeLooper
	DefaultContext context.Context
	// contains filtered or unexported fields
}

func (*Relayer) Relay added in v0.10.0

func (r *Relayer) Relay() error

Relay reads messages from Kafka and sends them to RelayCh which is then read by relay.Run()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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