|
@@ -1,5 +1,7 @@
|
|
|
package sarama
|
|
package sarama
|
|
|
|
|
|
|
|
|
|
+import "log"
|
|
|
|
|
+
|
|
|
// OffsetMethod is passed in ConsumerConfig to tell the consumer how to determine the starting offset.
|
|
// OffsetMethod is passed in ConsumerConfig to tell the consumer how to determine the starting offset.
|
|
|
type OffsetMethod int
|
|
type OffsetMethod int
|
|
|
|
|
|
|
@@ -72,6 +74,10 @@ func NewConsumer(client *Client, topic string, partition int32, group string, co
|
|
|
config = new(ConsumerConfig)
|
|
config = new(ConsumerConfig)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if config.MaxWaitTime == 0 && config.MinFetchSize == 0 && config.DefaultFetchSize == 0 {
|
|
|
|
|
+ log.Println("ConsumerConfig{MaxWaitTime, MinFetchSize, DefaultFetchSize} are all set to 0. This causes busy-looping when no events are available. You should seriously consider changing these values. MinFetchSize should be at least 1 in almost all scenarios.")
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if config.DefaultFetchSize < 0 {
|
|
if config.DefaultFetchSize < 0 {
|
|
|
return nil, ConfigurationError("Invalid DefaultFetchSize")
|
|
return nil, ConfigurationError("Invalid DefaultFetchSize")
|
|
|
} else if config.DefaultFetchSize == 0 {
|
|
} else if config.DefaultFetchSize == 0 {
|