consumer

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer interface {
	io.Closer

	// Name returns the name of this consumer group.
	Name() string
	// Topics returns the names of the topics being consumed.
	Topics() []string
	// Errors returns a channel of errors for the topic. To prevent deadlocks,
	// users must read from the error channel.
	//
	// All errors returned from this channel can be safely cast to the
	// consumer.Error interface, which allows structured access to the topic
	// name and partition number.
	Errors() <-chan error
	// Closed returns a channel that unblocks when the consumer successfully shuts
	// down.
	Closed() <-chan struct{}
	// Messages returns a channel of messages for the topic.
	//
	// If the consumer is not configured with nonzero buffer size, the Errors()
	// channel must be read in conjunction with Messages() to prevent deadlocks.
	Messages() <-chan Message
	// CommitUpTo marks this message and all previous messages in the same partition
	// as processed. The last processed offset for each partition is periodically
	// flushed to ZooKeeper; on startup, consumers begin processing after the last
	// stored offset.
	CommitUpTo(Message) error
}

A Consumer allows users to read and process messages from a Kafka topic. Consumer processes within the same group use ZooKeeper to negotiate partition ownership, so each process sees a stream of messages from one or more partitions. Within a partition, messages are linearizable.

type Message

type Message interface {
	// Key is a mutable reference to the message's key.
	Key() []byte
	// Value is a mutable reference to the message's value.
	Value() []byte
	// Topic is the topic from which the message was read.
	Topic() string
	// Partition is the ID of the partition from which the message was read.
	Partition() int32
	// Offset is the message's offset.
	Offset() int64
	// Ack the message
	Ack()
	// Nack the message
	Nack()
	// Cluster is the message's originated cluster.
	Cluster() string
}

Message is a single message pulled off a Kafka topic.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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