简体   繁体   中英

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

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

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" 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM