package Ġio . hol ix on . avro . adapter . registry . ax on . core Ċ Ċ import Ġh ol ix on . registry . event . Av ro Schema Registered Event Ċ import Ġio . hol ix on . avro . adapter . api . Av ro Schema With Id Ċ import Ġio . hol ix on . avro . adapter . api . Schema Id Supplier Ċ import Ġio . hol ix on . avro . adapter . api . Schema Revision Resolver Ċ import Ġio . hol ix on . avro . adapter . common . registry . InMemory Av ro Schema Registry Ċ import Ġio . hol ix on . avro . adapter . registry . ax on . api . Find All Schema Ċ import Ġio . hol ix on . avro . adapter . registry . ax on . api . Find All Schema By Canonical Name Ċ import Ġio . hol ix on . avro . adapter . registry . ax on . api . Find Schema ById Ċ import Ġio . hol ix on . avro . adapter . registry . ax on . api . Find Schema By Info Ċ import Ġio . hol ix on . avro . adapter . registry . ax on . core . Av ro Registry Projection . Companion . GROUP _ NAME Ċ import Ġorg . apache . avro . Schema Ċ import Ġorg . ax on framework . config . Processing Group Ċ import Ġorg . ax on framework . event handling . EventHandler Ċ import Ġorg . ax on framework . query handling . Query Handler Ċ import Ġorg . ax on framework . query handling . Query Update Emitter Ċ import Ġorg . springframework . stereotype . Component Ċ import Ġjava . util .* Ċ Ċ /** Ċ Ġ* ĠProjection Ġbacked Ġby Ġan Ġin - memory Ġregistry . Ċ Ġ*/ Ċ @ Component Ċ @ Processing Group ( GROUP _ NAME ) Ċ class ĠAv ro Registry Projection ( ĊĠ Ġprivate Ġval Ġschema Id Supplier : ĠSchema Id Supplier , ĊĠ Ġprivate Ġval Ġschema Revision Resolver : ĠSchema Revision Resolver , ĊĠ Ġprivate Ġval Ġquery Update Emitter : ĠQuery Update Emitter Ċ ) Ġ{ ĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġconst Ġval ĠGROUP _ NAME Ġ= Ġ" io . hol ix on . avro . adapter . registry . ax on " ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠRegistry Ġfor Ġbacking . ĊĠĠ Ġ*/ ĊĠ Ġprivate Ġval Ġregistry Ġ= ĠIn Memory Av ro Schema Registry ( ĊĠĠĠ Ġschema Id Supplier Ġ= Ġschema Id Supplier , ĊĠĠĠ Ġschema Revision Resolver Ġ= Ġschema Revision Resolver ĊĠ Ġ) ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠRegistration Ġof Ġthe Ġschemas . ĊĠĠ Ġ*/ ĊĠ Ġ@ EventHandler ĊĠ Ġfun Ġon ( event : ĠAv ro Schema Registered Event ) Ġ{ ĊĠĠĠ Ġval Ġregistered : ĠAv ro Schema With Id Ġ= Ġregistry . register ( Schema . Parser (). parse ( event . content )) ĊĠĠĠ Ġquery Update Emitter . emit ( Find Schema ById :: class . java , ĠFind Schema ById . predicate ( registered . schema Id ), ĠOptional . of ( registered )) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠFinds Ġa Ġschema Ġby Ġid . ĊĠĠ Ġ*/ ĊĠ Ġ@ Query Handler ĊĠ Ġfun Ġquery ( query : ĠFind Schema ById ): ĠOptional < Av ro Schema With Id > Ġ{ ĊĠĠĠ Ġreturn Ġregistry . findById ( schema Id Ġ= Ġquery . schema Id ) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠFinds Ġa Ġschema Ġby Ġinfo . ĊĠĠ Ġ*/ ĊĠ Ġ@ Query Handler ĊĠ Ġfun Ġquery ( query : ĠFind Schema By Info ): ĠOptional < Av ro Schema With Id > Ġ{ ĊĠĠĠ Ġreturn Ġregistry . findBy Info ( info Ġ= Ġquery . info ) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠFinds Ġall Ġschemas Ġby Ġnamespace , Ġname Ġand Ġoptional Ġrevision . ĊĠĠ Ġ*/ ĊĠ Ġ@ Query Handler ĊĠ Ġfun Ġquery ( query : ĠFind All Schema By Canonical Name ): ĠList < Av ro Schema With Id > Ġ{ ĊĠĠĠ Ġreturn Ġregistry . findAll By Canonical Name ( namespace Ġ= Ġquery . namespace , Ġname Ġ= Ġquery . name ) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠFinds Ġall Ġschemas . ĊĠĠ Ġ*/ ĊĠ Ġ@ Query Handler ĊĠ Ġfun Ġquery ( query : ĠFind All Schema ): ĠList < Av ro Schema With Id > Ġ{ ĊĠĠĠ Ġreturn Ġregistry . findAll () ĊĠ Ġ} Ċ } Ċ