producer

package
v0.0.0-...-c4b8a4c Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2015 License: Apache-2.0 Imports: 2 Imported by: 7

Documentation

Overview

package producer provides simplified usage of Kafka producers build on top of https://github.com/Shopify/sarama

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KafkaProducer

type KafkaProducer struct {
	//the topic to consume from
	Topic string

	/* This is for bootstrapping and the producer will only use it for getting metadata (topics, partitions and replicas).
	   The socket connections for sending the actual data will be established based on the broker information returned in
	   the metadata. */
	BrokerList []string
	// contains filtered or unexported fields
}

KafkaProducer publishes Kafka messages to a given topic. You MUST call Close() on a producer to avoid leaks, it will not be garbage-collected automatically when it passes out of scope.

func NewKafkaProducer

func NewKafkaProducer(topic string, brokerList []string) *KafkaProducer

NewKafkaProducer creates a new produce. It will publish messages to the given topic. You may also provide a sarama.ProducerConfig with more precise configurations or nil to use default configuration

func (*KafkaProducer) Close

func (kafkaProducer *KafkaProducer) Close()

Close indicates that no more messages will be produced with this producer and closes all underlying connections. It is required to call this function before a producer object passes out of scope, as it will otherwise leak memory.

func (*KafkaProducer) SendBytesSync

func (kafkaProducer *KafkaProducer) SendBytesSync(message []byte) error

func (*KafkaProducer) SendStringSync

func (kafkaProducer *KafkaProducer) SendStringSync(message string) error

Jump to

Keyboard shortcuts

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