Hi, I believe the answer is in the code. This is where the --compression-codec is processed: https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/tools/ConsoleProducer.scala#L143 and this is —producer-property: https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/tools/ConsoleProducer.scala#L234
The usage is here: https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/tools/ConsoleProducer.scala#L114 The answer is: The console producer allows for compression codec only with —compression-codec argument. – Best regards, Radek Gruchalski ra...@gruchalski.com On October 17, 2016 at 7:46:41 AM, ZHU Hua B (hua.b....@alcatel-lucent.com) wrote: Hi, Anybody could help to answer this question? Thanks! Best Regards Johnny -----Original Message----- From: ZHU Hua B Sent: 2016年10月14日 16:41 To: users@kafka.apache.org Subject: [COMMERCIAL] A question about kafka Hi, I have a question about kafka, could you please help to have a look? I want to send a message from producer with snappy compression codec. So I run the command "bin/kafka-console-producer.sh --compression-codec snappy --broker-list localhost:9092 --topic test", after that I checked the data log, compresscodec is SnappyCompressionCodec as expectation. Then I tried another command "bin/kafka-console-producer.sh --producer-property compression.type=snappy --broker-list localhost:9092 --topic test" to send a message from producer with snappy also, but this time I found compresscodec is NoCompressionCodec in data log. I double checked the option of "kafka-console-producer.sh" as below, seems both "--compression-codec" and "--producer-property" could be used to set up compression codec, why the second way failed? The "key=value" I found in config/producer.properties, so I think it is regular. Thanks! # bin/kafka-console-producer.sh --help --compression-codec [compression-codec] The compression codec: either 'none','gzip', 'snappy', or 'lz4'.If specified without value, then it defaults to 'gzip'. --producer-property <producer_prop> A mechanism to pass user-defined properties in the form key=value to the producer. --producer.config <config file> Producer config properties file. Note that [producer-property] takes precedence over this config. Best Regards Johnny