Java 提供了kafka schema.registry.url,但不是';不是已知的配置
试图使用模式注册表发布主题上的json消息,但出现以下错误。以下弹簧启动方法Java 提供了kafka schema.registry.url,但不是';不是已知的配置,java,apache-kafka,confluent-schema-registry,Java,Apache Kafka,Confluent Schema Registry,试图使用模式注册表发布主题上的json消息,但出现以下错误。以下弹簧启动方法 提供了配置“schema.registry.url”,但不是已知的配置 应用程序yml fle server: port: 9080 spring: kafka: properties: bootstrap.servers: server1:8080 schema.registry.url: https://bctdsdg:8081/ producer: k
提供了配置“schema.registry.url”,但不是已知的配置
应用程序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
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
卡夫卡配置@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());
}
}
在生产者和消费者属性下配置架构注册表url 应用程序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
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
那个消息不是一个错误。。。您遇到了什么问题?我无法发布有关架构注册表主题的消息。。2020-11-17 13:52:19.593警告15836---[ad|producer-1]org.apache.kafka.clients.NetworkClient:[producer clientId=producer-1]引导代理localhost:9094(id:-2 rack:null)断开连接此消息进入日志您给定的代码显示为
server1:8080
,那么您从哪里获得localhost:9094?