7.6. Kafka Streams 애플리케이션의 스키마 사용
다음 절차에서는 서비스 레지스트리에서 Apache Avro 스키마를 사용하도록 Java로 작성된 Kafka Streams 클라이언트를 구성하는 방법을 설명합니다.
사전 요구 사항
- 서비스 레지스트리가 설치됨
- 스키마는 서비스 레지스트리에 등록됨
프로세스
서비스 레지스트리 URL을 사용하여 Java 클라이언트를 생성하고 구성합니다.
String registryUrl = "https://registry.example.com/apis/registry/v2"; RegistryService client = RegistryClient.cached(registryUrl);
String registryUrl = "https://registry.example.com/apis/registry/v2"; RegistryService client = RegistryClient.cached(registryUrl);
Copy to Clipboard Copied! Toggle word wrap Toggle overflow serializer 및 deserializer를 구성합니다.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Kafka Streams 클라이언트를 생성합니다.
KStream<String, LogInput> input = builder.stream( INPUT_TOPIC, Consumed.with(Serdes.String(), logSerde) );
KStream<String, LogInput> input = builder.stream( INPUT_TOPIC, Consumed.with(Serdes.String(), logSerde) );
Copy to Clipboard Copied! Toggle word wrap Toggle overflow