apache-kafkaspring-cloud-stream

Spring Cloud Streams ignores parameters of producer


I'm developing a simple service that is consuming messages from one Kafka topic and producing modified messages to another topic. The service works fine except settings paremeter "compression type" of the producer.

Parameter "compression: gzip" are ignored by SCS and set default values "none" Regarding documentation I should set

spring.cloud.stream.kafka.bindings.<channelName>.producer.compression.type

I've tried it

spring:
  cloud:
    stream:
      bindings:
        process-in-0:
          destination: in-topic
          binder: kafkaProd
          group: ms-pos-sales-mirror
        process-out-0:
          destination: out-topic
          binder: kafkaNewProd
          producer:
            compression: gzip

And tried this

spring:
  cloud:
    stream:
      bindings:
        process-in-0:
          destination: in-topic
          binder: kafkaProd
          group: ms-pos-sales-mirror
        process-out-0:
          destination: out-topic
          binder: kafkaNewProd
          producer:
            configuration:
              compression:
                type: gzip

The results were the same: both times compression type parameter was ignored. What did I do wrong?


Solution

  • In both cases you are missing kafka part of the property:

    spring:
      cloud:
        stream:
          kafka:
            bindings:
              process-out-0:
                producer:
                  compression-type: gzip