kafka

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxBytes  = 1048576 // 1MB
	DefaultMaxWait   = 50 * time.Millisecond
	DefaultBatchSize = 1
)

Variables

This section is empty.

Functions

func NewReader added in v0.1.0

func NewReader(opts *cli.Options) (*skafka.Reader, error)

func NewWriter added in v0.1.0

func NewWriter(opts *cli.Options) (*skafka.Writer, error)

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

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 Kafka

type Kafka struct {
	Id          string
	Reader      *skafka.Reader
	Writer      *skafka.Writer
	Options     *cli.Options
	MessageDesc *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.

Jump to

Keyboard shortcuts

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