Casel Chen
Casel Chen

Reputation: 547

How to use Spring Cloud Stream Kafka with Confluent Schema Registry?

I am seeking a simple workable example which use Spring Cloud Stream Kafka with Confluent Schema Registry (producer & consumer). I followed the spring cloud stream reference guide by adding the following code but it didn't work. Can anyone guide me how to achieve it? Many thanks!

@Bean
public SchemaRegistryClient schemaRegistryClient(@Value("${spring.cloud.stream.schemaRegistryClient.endpoint}") String endpoint){
  ConfluentSchemaRegistryClient client = new ConfluentSchemaRegistryClient();
  client.setEndpoint(endpoint);
  return client;
}

Upvotes: 1

Views: 2867

Answers (2)

Udara S.S Liyanage
Udara S.S Liyanage

Reputation: 6453

I tried this schema registry sample and it worked for me. All instructions are mentioned in README file.

Upvotes: 1

charlb
charlb

Reputation: 1249

Here is a simple example that shows spring cloud stream with Avro serialization. This example stubs and mocks out the schema registry.

Your bean looks correct, you just need a running schema registry and configuration for "spring.cloud.stream.schemaRegistryClient.endpoint" in application.properties (or application.yml)

Upvotes: 1

Related Questions