Package org.mockserver.async.serde
Class SchemaRegistryClient
java.lang.Object
org.mockserver.async.serde.SchemaRegistryClient
A minimal client for the Confluent Schema Registry REST API — just the two
operations MockServer needs, implemented over the JDK's
HttpClient so no
Confluent Community License artifacts are pulled in:
getSchemaById(int)—GET /schemas/ids/{id}, used on the consume/verify path to resolve the schema embedded in a Confluent wire-format message.register(String, String)—POST /subjects/{subject}/versions, used on the publish path to obtain the schema id to frame messages with.
Both results are cached: schema-by-id is immutable, and a (subject, schema) registration is idempotent and returns a stable id, so repeated publishes do not re-hit the registry.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetSchemaById(int id) Resolve an Avro schema's JSON text by its registered id.intRegister (idempotently) an Avro schema under the given subject and return its id.
-
Constructor Details
-
SchemaRegistryClient
-
-
Method Details
-
getSchemaById
Resolve an Avro schema's JSON text by its registered id.- Parameters:
id- the schema id embedded in a Confluent wire-format message- Returns:
- the Avro schema JSON text
-
register
Register (idempotently) an Avro schema under the given subject and return its id.- Parameters:
subject- the registry subject (typically<topic>-value)schemaJson- the Avro schema JSON text- Returns:
- the registered schema id
-