v0.11.4
Announcements
-
This release drops support for Golang < 1.7
-
Requires librdkafka v0.11.4 or later
Message header support
Support for Kafka message headers has been added (requires broker version >= v0.11.0).
When producing messages, pass a []kafka.Header
list:
err = p.Produce(&kafka.Message{
TopicPartition: kafka.TopicPartition{Topic: &topic, Partition: kafka.PartitionAny},
Value: []byte(value),
Headers: []kafka.Header{{"myTestHeader", []byte("header values are binary")}},
}, deliveryChan)
Message headers are available to the consumer as Message.Headers
:
msg, err := c.ReadMessage(-1)
if err != nil {
fmt.Printf("%% Consumer error: %v\n", err)
continue
}
fmt.Printf("%% Message on %s:\n%s\n", msg.TopicPartition, string(msg.Value))
if msg.Headers != nil {
fmt.Printf("%% Headers: %v\n", msg.Headers)
}
Enhancements
- Message Headers support
- Close event channel when consumer is closed (#123 by @czchen)
- Added ReadMessage() convenience method to Consumer
- producer: Make events channel size configurable (@agis)
- Added Consumer.StoreOffsets() (#72)
- Added ConfigMap.Get() (#26)
- Added Pause() and Resume() APIs
- Added Consumer.Committed() API
- Added OffsetsForTimes() API to Consumer and Producer
Fixes
- Static builds should now work on both OSX and Linux (#137, #99)
- Update error constants from librdkafka
- Enable produce.offset.report by default (unless overriden)
- move test helpers that need testing pkg to _test.go file (@gwilym)
- Build and run-time checking of librdkafka version (#88)
- Remove gotos (@jadekler)
- Fix Producer Value&Key slice referencing to avoid cgo pointer checking failures (#24)
- Fix Go 1.10 build errors (drop
pkg-config --static ..
)