Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsProducerErrTemporary ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewAzureEventHubs ¶
NewAzureEventHubs returns a Kafka client pre-configured to connect to Azure Event Hubs addresses should be in the form of "host:port" where the port is usually 9093 on Azure Event Hubs Also make sure to select at least the Standard tier since the Basic tier does not support Kafka
func NewConfluentCloud ¶
NewConfluentCloud returns a Kafka client pre-configured to connect to Confluent Cloud
func (*Client) NewConsumer ¶
func (c *Client) NewConsumer(topic string, conf ConsumerConfig) *Consumer
NewConsumer instantiates a new consumer.
func (*Client) NewProducer ¶
func (c *Client) NewProducer(producerConf ProducerConfig) (p *Producer, err error)
NewProducer instantiates a new producer. To use it asynchronously just do "go p.Publish(ctx, msgs)".
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer provides a high-level API for reading messages from Kafka
func (*Consumer) Close ¶
Close tries to close the consumer, but it will return sooner if the context is canceled. A routine in background will still try to close the producer since the underlying library does not support contexts on Close().
type ConsumerConfig ¶
type ConsumerStartOffset ¶
type ConsumerStartOffset int64
const ( // LastOffset is the most recent offset available for a partition LastOffset ConsumerStartOffset = iota // FirstOffset is the least recent offset available for a partition FirstOffset )
type Logger ¶
type Logger interface {
Printf(format string, args ...interface{})
}
Logger specifies a logger used to report internal changes within the consumer
type Message ¶
type Message struct {
Key, Value []byte
Topic string
Partition int32
Offset int64
Headers []MessageHeader
Timestamp time.Time
}
Message is a data structure representing a Kafka message
type MessageHeader ¶
MessageHeader is a key/value pair type representing headers set on records
type Producer ¶
type Producer struct {
// contains filtered or unexported fields
}
Producer provides a high-level API for producing messages to Kafka
type ProducerConfig ¶
type SASL ¶
type SASL struct { ScramHashGen ScramHashGenerator Username, Password string }
type ScramHashGenerator ¶
type ScramHashGenerator uint8
const ( ScramPlainText ScramHashGenerator = iota ScramSHA256 ScramSHA512 )
func ScramHashGeneratorFromString ¶
func ScramHashGeneratorFromString(s string) (ScramHashGenerator, error)
ScramHashGeneratorFromString returns the proper ScramHashGenerator from its string counterpart
func (ScramHashGenerator) String ¶
func (s ScramHashGenerator) String() string