kafka

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncProducer

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

AsyncProducer defines a async Kafka producer.

func NewAsyncProducer

func NewAsyncProducer(brokers []string, version string) (*AsyncProducer, error)

NewAsyncProducer creates a new async producer with default configuration.

func (*AsyncProducer) Close

func (ap *AsyncProducer) Close() error

Close gracefully the producer.

func (*AsyncProducer) Error

func (ap *AsyncProducer) Error() <-chan error

Error returns a chanel to monitor for errors.

func (*AsyncProducer) Send

func (ap *AsyncProducer) Send(ctx context.Context, msg *Message) error

Send a message to a topic.

type Message

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

Message abstraction of a Kafka message.

func NewJSONMessage

func NewJSONMessage(t string, d interface{}) (*Message, error)

NewJSONMessage creates a new message with a JSON encoded body.

func NewMessage

func NewMessage(t string, b []byte) *Message

NewMessage creates a new message.

type Producer

type Producer interface {
	Send(ctx context.Context, msg *Message) error
	Error() <-chan error
	Close() error
}

Producer interface for Kafka.

Jump to

Keyboard shortcuts

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