public final class SchemaRegistryClient extends Object
Register a schema
Registering a schema returns a unique schema id that can be used to quickly associate payloads with that schema.String schema = "{\"type\":\"enum\",\"name\":\"TEST\",\"symbols\":[\"UNIT\",\"INTEGRATION\"]}"; SchemaProperties properties = client.registerSchema("{schema-group}", "{schema-name}", schema, SchemaFormat.AVRO); System.out.printf("Schema id: %s, schema format: %s%n", properties.getId(), properties.getFormat());
Get a schema
SchemaRegistrySchema schema = client.getSchema("{schema-id}"); System.out.printf("Schema id: %s, schema format: %s%n", schema.getProperties().getId(), schema.getProperties().getFormat()); System.out.println("Schema contents: " + schema.getSchemaDefinition());
Get a schema's properties
String schema = "{\"type\":\"enum\",\"name\":\"TEST\",\"symbols\":[\"UNIT\",\"INTEGRATION\"]}"; SchemaProperties properties = client.getSchemaProperties("{schema-group}", "{schema-name}", schema, SchemaFormat.AVRO); System.out.println("The schema id: " + properties.getId());
Modifier and Type | Method and Description |
---|---|
String |
getFullyQualifiedNamespace()
Gets the fully qualified namespace of the Schema Registry instance.
|
SchemaRegistrySchema |
getSchema(String schemaId)
Gets the schema properties of the schema associated with the unique schema id.
|
SchemaProperties |
getSchemaProperties(String groupName,
String name,
String schemaDefinition,
SchemaFormat format)
Gets the schema properties associated with the given schema id.
|
com.azure.core.http.rest.Response<SchemaProperties> |
getSchemaPropertiesWithResponse(String groupName,
String name,
String schemaDefinition,
SchemaFormat format,
com.azure.core.util.Context context)
Gets the schema identifier associated with the given schema.
|
com.azure.core.http.rest.Response<SchemaRegistrySchema> |
getSchemaWithResponse(String schemaId,
com.azure.core.util.Context context)
Gets the schema properties of the schema associated with the unique schema schemaId.
|
SchemaProperties |
registerSchema(String groupName,
String name,
String schemaDefinition,
SchemaFormat format)
Registers a new schema in the specified schema group with the given schema name.
|
com.azure.core.http.rest.Response<SchemaProperties> |
registerSchemaWithResponse(String groupName,
String name,
String schemaDefinition,
SchemaFormat format,
com.azure.core.util.Context context)
Registers a new schema in the specified schema group with the given schema name.
|
public String getFullyQualifiedNamespace()
public SchemaProperties registerSchema(String groupName, String name, String schemaDefinition, SchemaFormat format)
groupName
- The schema group.name
- The schema name.schemaDefinition
- The string representation of the schema.format
- The serialization type of this schema.NullPointerException
- if groupName
, name
, format
, or
schemaDefinition
are null.public com.azure.core.http.rest.Response<SchemaProperties> registerSchemaWithResponse(String groupName, String name, String schemaDefinition, SchemaFormat format, com.azure.core.util.Context context)
groupName
- The schema group.name
- The schema name.schemaDefinition
- The string representation of the schema.format
- The serialization type of this schema.context
- The context to pass to the Http pipeline.NullPointerException
- if groupName
, name
, format
, or
schemaDefinition
are null.public SchemaRegistrySchema getSchema(String schemaId)
schemaId
- The unique identifier of the schema.SchemaProperties
associated with the given schemaId
.NullPointerException
- if schemaId
is null.public com.azure.core.http.rest.Response<SchemaRegistrySchema> getSchemaWithResponse(String schemaId, com.azure.core.util.Context context)
schemaId
- The unique identifier of the schema.context
- The context to pass to the Http pipeline.SchemaProperties
associated with the given id
and its HTTP response.NullPointerException
- if schemaId
is null.public SchemaProperties getSchemaProperties(String groupName, String name, String schemaDefinition, SchemaFormat format)
groupName
- The schema group.name
- The schema name.schemaDefinition
- The string representation of the schema.format
- The serialization type of this schema.public com.azure.core.http.rest.Response<SchemaProperties> getSchemaPropertiesWithResponse(String groupName, String name, String schemaDefinition, SchemaFormat format, com.azure.core.util.Context context)
groupName
- The schema group.name
- The schema name.schemaDefinition
- The string representation of the schema.format
- The serialization type of this schema.context
- The context to pass to the Http pipeline.NullPointerException
- if groupName
, name
, format
, or
schemaDefinition
are null.Visit the Azure for Java Developers site for more Java documentation, including quick starts, tutorials, and code samples.