2017-04-18 126 views

回答

2

是的,這是可能的。只需將compression.type設置爲gzip即可。

查看here的完整示例。

// Zookeeper connection properties 
val props = new HashMap[String, Object]() 
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, brokers) 
props.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "gzip") 
// add other props as needed 

val producer = new KafkaProducer[String, String](props) 
相關問題