How to disable/enable - Confluent KAFKA Interceptor using Spring boot profile?

Viewed 855

I'm writing a Spring Boot application that uses Confluent KAFKA replicator and below is my Spring boot profile

spring:
  kafka:
    consumer:
      properties:
        interceptor:
          classes: io.confluent.connect.replicator.offsets.ConsumerTimestampsInterceptor
        timestamp:
          producer:
            security:
              protocol: PLAINTEXT
            sasl:
              mechanism: NONE

I don't have Confluent KAFKA replicator in the lower environment - eg: Dev. So, I want a flag/profile property to disable/enable the above Confluent KAFKA Interceptor (ConsumerTimestampsInterceptor). How do I do it? Something like this

spring:
  kafka:
    consumer:
      properties:
        interceptor:
          enabled : false
1 Answers

You should be able to create a dev profile (for example, application-dev.yaml) for your spring application, then remove the property altogether. There is no enabled boolean property

Also, you shouldn't need full nesting since consumer properties are flat, anyways

spring:
  kafka:
    consumer:
      properties:
        interceptor.classes: "className" 
Related