|
|
@@ -1,7 +1,10 @@
|
|
|
package sarama
|
|
|
|
|
|
import (
|
|
|
+ "compress/gzip"
|
|
|
"crypto/tls"
|
|
|
+ "fmt"
|
|
|
+ "io/ioutil"
|
|
|
"regexp"
|
|
|
"time"
|
|
|
|
|
|
@@ -414,6 +417,14 @@ func (c *Config) Validate() error {
|
|
|
return ConfigurationError("lz4 compression requires Version >= V0_10_0_0")
|
|
|
}
|
|
|
|
|
|
+ if c.Producer.Compression == CompressionGZIP {
|
|
|
+ if c.Producer.CompressionLevel != CompressionLevelDefault {
|
|
|
+ if _, err := gzip.NewWriterLevel(ioutil.Discard, c.Producer.CompressionLevel); err != nil {
|
|
|
+ return ConfigurationError(fmt.Sprintf("gzip compression does not work with level %d: %v", c.Producer.CompressionLevel, err))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// validate the Consumer values
|
|
|
switch {
|
|
|
case c.Consumer.Fetch.Min <= 0:
|