kafka schema.registry.url was supplied but isn't a known config
Asked Answered
E

1

8

Trying to publish the json message on topic using schema registry but getting below error. followingspring boot approach
..

The configuration 'schema.registry.url' was supplied but isn't a known config

application yml fle

server:
  port: 9080
spring:
  kafka:
    properties:
      bootstrap.servers: server1:8080 
      schema.registry.url: https://bctdsdg:8081/
    producer:
      key-serializer: org.apache.kafka.common.serialization.StringSerializer 
      value-serializer: JsonSerializer.class        
    ssl:
      keystore-location: classpath:cert.jks
      keystore-password: pwd
      key-password: pwd
      truststore-location: classpath:dev_cacerts.jks
      truststore-password: pwd

kafka configuation

@Configuration
@EnableKafka
public class KafkaConfig {
    
    @Autowired
    private KafkaProperties kafkaProperties;
    
    @Bean
      public Map<String, Object> producerConfigs() {
        Map<String, Object> props = new HashMap<>();
        props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaProperties.getBootstrapServers());
        props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
        props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, com.schemaregjson.serdes.JsonSerializer.class);
        props.put("schema.registry.url", "https://bctdsdg:8081/");
        props.putAll(kafkaProperties.getSsl().buildProperties());
        props.putAll(kafkaProperties.getProperties());
        return props;
      }
    
     @Bean
        public ProducerFactory<String, User> producerFactory() {
            return new DefaultKafkaProducerFactory<>(producerConfigs());
        }
    
    @Bean
    public KafkaTemplate<String, User> kafkaTemplate() {
        return new KafkaTemplate<>(producerFactory());
    }
    
}

----------------------------------------------

@SpringBootApplication
public class SchemaregjsonApplication implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(SchemaregjsonApplication.class, args);
    }
    
    @Autowired
    private JsonProducer jsonproducer;
    User user = new User().withAge(34).withFirstname("Don").withLastname("Joe");
    @Override
    public void run(String... args) throws Exception {
        jsonproducer.send(user);
    }
}
Ermine answered 17/11, 2020 at 18:47 Comment(3)
That message isn't an error... What is the issue you're having?Repetitious
am unable to publish message on schema registry topic.. 2020-11-17 13:52:19.593 WARN 15836 --- [ad | producer-1] org.apache.kafka.clients.NetworkClient : [Producer clientId=producer-1] Bootstrap broker localhost:9094 (id: -2 rack: null) disconnected this message coming in logsErmine
Your given code says server1:8080, so where are you getting localhost:9094?Repetitious
E
0

configure schema registry url under producer and consumer properties.

application yml fle

spring:
  kafka:
      bootstrap.servers: server1:8080 
    producer:
      key-serializer: org.apache.kafka.common.serialization.StringSerializer 
      value-serializer: JsonSerializer.class   
    properties:
      schema.registry.url: http://localhost:8081      
    ssl:
      keystore-location: classpath:cert.jks
      keystore-password: pwd
      key-password: pwd
      truststore-location: classpath:dev_cacerts.jks
      truststore-password: pwd
Ermine answered 24/2, 2021 at 17:34 Comment(3)
Regardless of where I place the schema.registry.url I keep on getting the warningBryna
I'm having the same issue too. I don't think KafkaProducer client understands schema.registry.url as a property unlike KafkaStreamsDebarath
Same issue for me also. Anyone solved this issue?Speciality

© 2022 - 2024 — McMap. All rights reserved.