Back to godoc.org

Package producer

v1.9.0
Latest Go to latest
Published: Jun 19, 2020 | License: Apache-2.0 | Module: github.com/deviceinsight/kafkactl

Index

Package Files

func MurmurHasher

func MurmurHasher() hash.Hash32

MurmurHasher creates murmur2 hasher implementing hash.Hash32 interface. The implementation is not full and does not support streaming. It only implements the interface to comply with sarama.NewCustomHashPartitioner signature. But Sarama only uses Write method once, when writing keys and values of the message, so streaming support is not necessary.

func NewJVMCompatiblePartitioner

func NewJVMCompatiblePartitioner(topic string) sarama.Partitioner

NewJVMCompatiblePartitioner creates a Sarama partitioner that uses the same hashing algorithm as JVM Kafka clients.

type AvroMessageSerializer

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

func CreateAvroMessageSerializer

func CreateAvroMessageSerializer(topic string, avroSchemaRegistry string) (AvroMessageSerializer, error)

func (AvroMessageSerializer) CanSerialize

func (serializer AvroMessageSerializer) CanSerialize(topic string) (bool, error)

func (AvroMessageSerializer) Serialize

func (serializer AvroMessageSerializer) Serialize(key, value []byte, flags ProducerFlags) (*sarama.ProducerMessage, error)

type DefaultMessageSerializer

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

func (DefaultMessageSerializer) CanSerialize

func (serializer DefaultMessageSerializer) CanSerialize(_ string) (bool, error)

func (DefaultMessageSerializer) Serialize

func (serializer DefaultMessageSerializer) Serialize(key, value []byte, flags ProducerFlags) (*sarama.ProducerMessage, error)

type MessageSerializer

type MessageSerializer interface {
	CanSerialize(topic string) (bool, error)
	Serialize(key, value []byte, flags ProducerFlags) (*sarama.ProducerMessage, error)
}

type ProducerFlags

type ProducerFlags struct {
	Partitioner        string
	Partition          int32
	Separator          string
	LineSeparator      string
	File               string
	Key                string
	Value              string
	Headers            []string
	KeySchemaVersion   int
	ValueSchemaVersion int
	Silent             bool
	RateInSeconds      int
}

type ProducerOperation

type ProducerOperation struct {
}

func (*ProducerOperation) Produce

func (operation *ProducerOperation) Produce(topic string, flags ProducerFlags) error
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier