proxy

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set represents a collection of proxy.T instances with a default value.

func NewSet

func NewSet(proxies map[string]*T, defaultPxy *T) *Set

NewSet creates a proxy.Set from an alias to proxy map and a default proxy.

func (*Set) Get

func (s *Set) Get(alias string) (*T, error)

Get returns a proxy with the specified alias or the default proxy if there is no proxy with such alias.

type T

type T struct {
	// contains filtered or unexported fields
}

T implements a proxy to a particular Kafka/ZooKeeper cluster.

func Spawn

func Spawn(namespace *actor.ID, name string, cfg *config.Proxy) (*T, error)

Spawn creates a proxy instance and starts its internal goroutines.

func (*T) AsyncProduce

func (p *T) AsyncProduce(topic string, key, message sarama.Encoder)

AsyncProduce is an asynchronously counterpart of the `Produce` function. Errors are silently ignored.

func (*T) Consume

func (p *T) Consume(group, topic string) (*consumer.Message, error)

Consume consumes a message from the specified topic on behalf of the specified consumer group. If there are no more new messages in the topic at the time of the request then it will block for `Config.Consumer.LongPollingTimeout`. If no new message is produced during that time, then `ErrRequestTimeout` is returned.

Note that during state transitions topic subscribe<->unsubscribe and consumer group register<->deregister the method may return either `ErrBufferOverflow` or `ErrRequestTimeout` even when there are messages available for consumption. In that case the user should back off a bit and then repeat the request.

func (*T) GetAllTopicConsumers

func (p *T) GetAllTopicConsumers(topic string) (map[string]map[string][]int32, error)

GetAllTopicConsumers returns group -> client-id -> consumed-partitions-list mapping for a particular topic. Warning, the function performs scan of all consumer groups registered in ZooKeeper and therefore can take a lot of time.

func (*T) GetGroupOffsets

func (p *T) GetGroupOffsets(group, topic string) ([]admin.PartitionOffset, error)

GetGroupOffsets for every partition of the specified topic it returns the current offset range along with the latest offset and metadata committed by the specified consumer group.

func (*T) GetTopicConsumers

func (p *T) GetTopicConsumers(group, topic string) (map[string][]int32, error)

GetTopicConsumers returns client-id -> consumed-partitions-list mapping for a clients from a particular consumer group and a particular topic.

func (*T) Produce

func (p *T) Produce(topic string, key, message sarama.Encoder) (*sarama.ProducerMessage, error)

Produce submits a message to the specified `topic` of the Kafka cluster using `key` to identify a destination partition. The exact algorithm used to map keys to partitions is implementation specific but it is guaranteed that it returns consistent results. If `key` is `nil`, then the message is placed into a random partition.

Errors usually indicate a catastrophic failure of the Kafka cluster, or missing topic if there cluster is not configured to auto create topics.

func (*T) SetGroupOffsets

func (p *T) SetGroupOffsets(group, topic string, offsets []admin.PartitionOffset) error

SetGroupOffsets commits specific offset values along with metadata for a list of partitions of a particular topic on behalf of the specified group.

func (*T) Stop

func (p *T) Stop()

Stop terminates the proxy instances synchronously.

Jump to

Keyboard shortcuts

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