msgfetcher

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory interface {
	// Spawn creates and starts a fetcher instance that reads messages from the
	// given topic-partition starting from the specified offset. It will return
	// an error if there is an fetcher instance reading from the topic-partition
	// already.
	//
	// If the given offset does not exists in the topic-partition, then a real
	// offset that the fetcher will start reading from is determined as follows:
	//  * if the given offset equals to sarama.OffsetOldest or it is smaller
	//    then the oldest partition offset, then the oldest partition offset is
	//    selected;
	//  * if the given offset equals to sarama.OffsetNewest, or it is larger
	//    then the newest partition offset, then the newest partition offset is
	//    selected.
	// The real offset value is returned by the function.
	Spawn(parentActDesc *actor.Descriptor, topic string, partition int32, offset int64) (T, int64, error)

	// Stop shuts down the consumer. It must be called after all child partition
	// consumers have already been closed.
	Stop()
}

Factory provides API to spawn message fetcher that read messages from topic partitions. It ensures that there is only one fetcher instance for a particular topic partition at a time.

func SpawnFactory

func SpawnFactory(parentActDesc *actor.Descriptor, cfg *config.Proxy, kafkaClt sarama.Client) Factory

SpawnFactory creates a new message fetcher factory using the given client. It is still necessary to call Stop() on the underlying client after shutting down this factory.

type T

type T interface {
	// Messages returns the read channel for the messages that are fetched from
	// the topic partition.
	Messages() <-chan consumer.Message

	// Stop synchronously stops the partition consumer. It must be called
	// before the factory that created the instance can be stopped.
	Stop()
}

T fetched messages from a given topic and partition.

Jump to

Keyboard shortcuts

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