Skip to content

AnkushKhanna/kafka-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using schema registry with MockedStreams Kafka

Using mocked streams with AVRO and schema registry in Kafka have been a problem.

Mocked streams works fine for StringSerdes, but using SpecificAvroSerde or Avro type did not work so well.

Test suit

I have created a WireMock schema-registry client in SchemaRegistryAvroTest

You can simply extend to any of your test using extend as show in PersonTopologyBuilderTest

For now there is no library available, you can use it via just copying the SchemaRegistryAvroTest code in your code base.

Usage

You have to specifiy your schema registry url as s"http://localhost:${httpMockPort()}" in your test and register your schema as follow:

  register(s"input-topic-key", PersonKey.SCHEMA$)
  register(s"input-topic-value", PersonRecord.SCHEMA$)

where input-topic is the name of your input topic.

Example

PersonTopologyBuilderTest

Avrohugger

Using avro hugger to generate case classes from avro schema. PersonKey and PersonRecord are case classes generated by Avrohugger.

Please leave a Star if you use this code - Thank you

Releases

No releases published

Packages

No packages published

Languages