azure-docs-sdk-java/docs-ref-autogen/com.azure.data.schemaregist...

200 строки
27 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient"
fullName: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient"
name: "SchemaRegistryAsyncClient"
nameWithType: "SchemaRegistryAsyncClient"
summary: "<xref uid=\"com.azure.data.schemaregistry.SchemaRegistryAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SchemaRegistryAsyncClient\"></xref> is an HTTP-based client that interacts with Azure Schema Registry service to store and retrieve schemas on demand."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public final class **SchemaRegistryAsyncClient**"
methods:
- uid: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getFullyQualifiedNamespace()"
fullName: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getFullyQualifiedNamespace()"
name: "getFullyQualifiedNamespace()"
nameWithType: "SchemaRegistryAsyncClient.getFullyQualifiedNamespace()"
summary: "Gets the fully qualified namespace of the Schema Registry instance."
syntax: "public String getFullyQualifiedNamespace()"
desc: "Gets the fully qualified namespace of the Schema Registry instance."
returns:
description: "The fully qualified namespace of the Schema Registry instance."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchema(java.lang.String)"
fullName: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchema(String schemaId)"
name: "getSchema(String schemaId)"
nameWithType: "SchemaRegistryAsyncClient.getSchema(String schemaId)"
summary: "Gets the schema properties of the schema associated with the unique schema id."
parameters:
- description: "The unique identifier of the schema."
name: "schemaId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public Mono<SchemaRegistrySchema> getSchema(String schemaId)"
desc: "Gets the schema properties of the schema associated with the unique schema id."
returns:
description: "The <xref uid=\"com.azure.data.schemaregistry.models.SchemaRegistrySchema\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SchemaRegistrySchema\"></xref> associated with the given <code>schemaId</code>."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.data.schemaregistry.models.SchemaRegistrySchema?alt=com.azure.data.schemaregistry.models.SchemaRegistrySchema&text=SchemaRegistrySchema\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchema(java.lang.String,java.lang.String,int)"
fullName: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchema(String groupName, String schemaName, int schemaVersion)"
name: "getSchema(String groupName, String schemaName, int schemaVersion)"
nameWithType: "SchemaRegistryAsyncClient.getSchema(String groupName, String schemaName, int schemaVersion)"
summary: "Gets the schema properties of the schema associated with the group name, schema name, and schema version."
parameters:
- description: "Group name for the schema"
name: "groupName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Name of the schema"
name: "schemaName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Version of schema"
name: "schemaVersion"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<SchemaRegistrySchema> getSchema(String groupName, String schemaName, int schemaVersion)"
desc: "Gets the schema properties of the schema associated with the group name, schema name, and schema version."
returns:
description: "The <xref uid=\"com.azure.data.schemaregistry.models.SchemaRegistrySchema\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SchemaRegistrySchema\"></xref> matching the parameters."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.data.schemaregistry.models.SchemaRegistrySchema?alt=com.azure.data.schemaregistry.models.SchemaRegistrySchema&text=SchemaRegistrySchema\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchemaProperties(java.lang.String,java.lang.String,java.lang.String,com.azure.data.schemaregistry.models.SchemaFormat)"
fullName: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchemaProperties(String groupName, String name, String schemaDefinition, SchemaFormat format)"
name: "getSchemaProperties(String groupName, String name, String schemaDefinition, SchemaFormat format)"
nameWithType: "SchemaRegistryAsyncClient.getSchemaProperties(String groupName, String name, String schemaDefinition, SchemaFormat format)"
summary: "Gets the schema identifier associated with the given schema."
parameters:
- description: "The schema group."
name: "groupName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The schema name."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The string representation of the schema."
name: "schemaDefinition"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The serialization type of this schema."
name: "format"
type: "<xref href=\"com.azure.data.schemaregistry.models.SchemaFormat?alt=com.azure.data.schemaregistry.models.SchemaFormat&text=SchemaFormat\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<SchemaProperties> getSchemaProperties(String groupName, String name, String schemaDefinition, SchemaFormat format)"
desc: "Gets the schema identifier associated with the given schema. Gets a cached value if it exists, otherwise makes a call to the service."
returns:
description: "A mono that completes with the properties for a matching schema."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.data.schemaregistry.models.SchemaProperties?alt=com.azure.data.schemaregistry.models.SchemaProperties&text=SchemaProperties\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchemaPropertiesWithResponse(java.lang.String,java.lang.String,java.lang.String,com.azure.data.schemaregistry.models.SchemaFormat)"
fullName: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchemaPropertiesWithResponse(String groupName, String name, String schemaDefinition, SchemaFormat format)"
name: "getSchemaPropertiesWithResponse(String groupName, String name, String schemaDefinition, SchemaFormat format)"
nameWithType: "SchemaRegistryAsyncClient.getSchemaPropertiesWithResponse(String groupName, String name, String schemaDefinition, SchemaFormat format)"
summary: "Gets the schema identifier associated with the given schema."
parameters:
- description: "The schema group."
name: "groupName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The schema name."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The string representation of the schema."
name: "schemaDefinition"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The serialization type of this schema."
name: "format"
type: "<xref href=\"com.azure.data.schemaregistry.models.SchemaFormat?alt=com.azure.data.schemaregistry.models.SchemaFormat&text=SchemaFormat\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Response<SchemaProperties>> getSchemaPropertiesWithResponse(String groupName, String name, String schemaDefinition, SchemaFormat format)"
desc: "Gets the schema identifier associated with the given schema. Always makes a call to the service."
returns:
description: "A mono that completes with the properties for a matching schema."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.data.schemaregistry.models.SchemaProperties?alt=com.azure.data.schemaregistry.models.SchemaProperties&text=SchemaProperties\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchemaWithResponse(java.lang.String)"
fullName: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchemaWithResponse(String schemaId)"
name: "getSchemaWithResponse(String schemaId)"
nameWithType: "SchemaRegistryAsyncClient.getSchemaWithResponse(String schemaId)"
summary: "Gets the schema properties of the schema associated with the unique schema id."
parameters:
- description: "The unique identifier of the schema."
name: "schemaId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public Mono<Response<SchemaRegistrySchema>> getSchemaWithResponse(String schemaId)"
desc: "Gets the schema properties of the schema associated with the unique schema id."
returns:
description: "The <xref uid=\"com.azure.data.schemaregistry.models.SchemaRegistrySchema\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SchemaRegistrySchema\"></xref> associated with the given <code>schemaId</code> along with the HTTP response."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.data.schemaregistry.models.SchemaRegistrySchema?alt=com.azure.data.schemaregistry.models.SchemaRegistrySchema&text=SchemaRegistrySchema\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchemaWithResponse(java.lang.String,java.lang.String,int)"
fullName: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchemaWithResponse(String groupName, String schemaName, int schemaVersion)"
name: "getSchemaWithResponse(String groupName, String schemaName, int schemaVersion)"
nameWithType: "SchemaRegistryAsyncClient.getSchemaWithResponse(String groupName, String schemaName, int schemaVersion)"
summary: "Gets the schema properties of the schema associated with the group name, schema name, and schema version."
parameters:
- description: "Group name for the schema"
name: "groupName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Name of the schema"
name: "schemaName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Version of schema"
name: "schemaVersion"
type: "<xref href=\"int?alt=int&text=int\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Response<SchemaRegistrySchema>> getSchemaWithResponse(String groupName, String schemaName, int schemaVersion)"
desc: "Gets the schema properties of the schema associated with the group name, schema name, and schema version."
returns:
description: "The <xref uid=\"com.azure.data.schemaregistry.models.SchemaRegistrySchema\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SchemaRegistrySchema\"></xref> matching the parameters."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.data.schemaregistry.models.SchemaRegistrySchema?alt=com.azure.data.schemaregistry.models.SchemaRegistrySchema&text=SchemaRegistrySchema\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
- uid: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.registerSchema(java.lang.String,java.lang.String,java.lang.String,com.azure.data.schemaregistry.models.SchemaFormat)"
fullName: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.registerSchema(String groupName, String name, String schemaDefinition, SchemaFormat format)"
name: "registerSchema(String groupName, String name, String schemaDefinition, SchemaFormat format)"
nameWithType: "SchemaRegistryAsyncClient.registerSchema(String groupName, String name, String schemaDefinition, SchemaFormat format)"
summary: "Registers a new schema in the specified schema group with the given schema name."
parameters:
- description: "The schema group."
name: "groupName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The schema name."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The string representation of the schema."
name: "schemaDefinition"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The serialization type of this schema."
name: "format"
type: "<xref href=\"com.azure.data.schemaregistry.models.SchemaFormat?alt=com.azure.data.schemaregistry.models.SchemaFormat&text=SchemaFormat\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<SchemaProperties> registerSchema(String groupName, String name, String schemaDefinition, SchemaFormat format)"
desc: "Registers a new schema in the specified schema group with the given schema name. If a schema **does not exist**does not exist with the same `groupName`, `name`, `format`, and `schemaDefinition`, it is added to the Schema Registry Instance and assigned a schema id. If a schema exists with a matching `groupName`, `name`, `format`, and `schemaDefinition`, the id of that schema is returned. If the Schema Registry instance contains an existing `groupName`, `name`, and `format` but the `schemaDefinition` is different, it is considered a new version, and schema id is assigned to it."
returns:
description: "The <xref uid=\"com.azure.data.schemaregistry.models.SchemaProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SchemaProperties\"></xref> of a successfully registered schema."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.data.schemaregistry.models.SchemaProperties?alt=com.azure.data.schemaregistry.models.SchemaProperties&text=SchemaProperties\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.registerSchemaWithResponse(java.lang.String,java.lang.String,java.lang.String,com.azure.data.schemaregistry.models.SchemaFormat)"
fullName: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient.registerSchemaWithResponse(String groupName, String name, String schemaDefinition, SchemaFormat format)"
name: "registerSchemaWithResponse(String groupName, String name, String schemaDefinition, SchemaFormat format)"
nameWithType: "SchemaRegistryAsyncClient.registerSchemaWithResponse(String groupName, String name, String schemaDefinition, SchemaFormat format)"
summary: "Registers a new schema in the specified schema group with the given schema name."
parameters:
- description: "The schema group."
name: "groupName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The schema name."
name: "name"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The string representation of the schema."
name: "schemaDefinition"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "The serialization type of this schema."
name: "format"
type: "<xref href=\"com.azure.data.schemaregistry.models.SchemaFormat?alt=com.azure.data.schemaregistry.models.SchemaFormat&text=SchemaFormat\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<Response<SchemaProperties>> registerSchemaWithResponse(String groupName, String name, String schemaDefinition, SchemaFormat format)"
desc: "Registers a new schema in the specified schema group with the given schema name. If a schema **does not exist**does not exist with the same `groupName`, `name`, `format`, and `schemaDefinition`, it is added to the Schema Registry Instance and assigned a schema id. If a schema exists with a matching `groupName`, `name`, `format`, and `schemaDefinition`, the id of that schema is returned. If the Schema Registry instance contains an existing `groupName`, `name`, and `format` but the `schemaDefinition` is different, it is considered a new version, and schema id is assigned to it."
returns:
description: "The schema properties on successful registration of the schema."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.core.http.rest.Response?alt=com.azure.core.http.rest.Response&text=Response\" data-throw-if-not-resolved=\"False\" />&lt;<xref href=\"com.azure.data.schemaregistry.models.SchemaProperties?alt=com.azure.data.schemaregistry.models.SchemaProperties&text=SchemaProperties\" data-throw-if-not-resolved=\"False\" />&gt;&gt;"
type: "class"
desc: "<xref uid=\"com.azure.data.schemaregistry.SchemaRegistryAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SchemaRegistryAsyncClient\"></xref> is an HTTP-based client that interacts with Azure Schema Registry service to store and retrieve schemas on demand. Azure Schema Registry supports multiple schema formats such as Avro, JSON, and custom formats.\n\n**Sample: Construct a <xref uid=\"com.azure.data.schemaregistry.SchemaRegistryAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"SchemaRegistryAsyncClient\"></xref>**\n\nThe following code sample demonstrates the creation of the asynchronous client <xref uid=\"com.azure.data.schemaregistry.SchemaRegistryAsyncClient\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.data.schemaregistry.SchemaRegistryAsyncClient\"></xref>. The `fullyQualifiedNamespace` is the Event Hubs Namespace's host name. It is listed under the \"Essentials\" panel after navigating to the Event Hubs Namespace via Azure Portal. The credential used is `DefaultAzureCredential` for authentication, which is appropriate for most scenarios, including local development and production environments. Additionally, we recommend using [managed identity][] for authentication in production environments. You can find more information on different ways of authenticating and their corresponding credential types in the [Azure Identity documentation\"][Azure Identity documentation].\n\n```java\nDefaultAzureCredential azureCredential = new DefaultAzureCredentialBuilder()\n .build();\n SchemaRegistryAsyncClient client = new SchemaRegistryClientBuilder()\n .fullyQualifiedNamespace(\"https://<your-schema-registry-endpoint>.servicebus.windows.net\")\n .credential(azureCredential)\n .buildAsyncClient();\n```\n\n**Sample: Register a schema**\n\nRegistering a schema returns a unique schema id that can be used to quickly associate payloads with that schema. The credential used is `DefaultAzureCredential` because it combines commonly used credentials in deployment and development and chooses the credential to used based on its running environment. Reactive operations must be subscribed to; this kicks off the operation. <xref uid=\"com.azure.data.schemaregistry.SchemaRegistryAsyncClient.registerSchema(java.lang.String,java.lang.String,java.lang.String,com.azure.data.schemaregistry.models.SchemaFormat)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#registerSchema(String, String, String, SchemaFormat)\"></xref> is a non-blocking call, the program will move onto the next line of code after setting up the async operation.\n\n```java\nString schema = \"{\\\"type\\\":\\\"enum\\\",\\\"name\\\":\\\"TEST\\\",\\\"symbols\\\":[\\\"UNIT\\\",\\\"INTEGRATION\\\"]}\";\n client.registerSchema(\"{schema-group}\", \"{schema-name}\", schema, SchemaFormat.AVRO)\n .subscribe(properties -> {\n System.out.printf(\"Schema id: %s, schema format: %s%n\", properties.getId(),\n properties.getFormat());\n }, error -> {\n System.err.println(\"Error occurred registering schema: \" + error);\n }, () -> {\n System.out.println(\"Register schema completed.\");\n });\n```\n\n**Sample: Get a schema using a schema id**\n\nThe following code sample demonstrates how to fetch a schema using its schema id. The schema id can be found in <xref uid=\"com.azure.data.schemaregistry.models.SchemaProperties.getId()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.data.schemaregistry.models.SchemaProperties#getId()\"></xref> when a schema is registered or using <xref uid=\"com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchemaProperties(java.lang.String,java.lang.String,java.lang.String,com.azure.data.schemaregistry.models.SchemaFormat)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"com.azure.data.schemaregistry.SchemaRegistryAsyncClient#getSchemaProperties(java.lang.String, java.lang.String, java.lang.String, com.azure.data.schemaregistry.models.SchemaFormat)\"></xref>. Reactive operations must be subscribed to; this kicks off the operation. <xref uid=\"com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchema(java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#getSchema(String)\"></xref> is a non-blocking call, the program will move onto the next line of code after setting up the async operation.\n\n```java\nclient.getSchema(\"{schema-id}\")\n .subscribe(schema -> {\n System.out.printf(\"Schema id: %s, schema format: %s%n\", schema.getProperties().getId(),\n schema.getProperties().getFormat());\n System.out.println(\"Schema contents: \" + schema.getDefinition());\n }, error -> {\n System.err.println(\"Error occurred getting schema: \" + error);\n }, () -> {\n System.out.println(\"Get schema completed.\");\n });\n```\n\n**Sample: Get a schema's properties**\n\nThe following code sample demonstrates how to get a schema's properties given its schema contents. Fetching schema properties is useful in cases where developers want to get the unique schema id. <xref uid=\"com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchemaProperties(java.lang.String,java.lang.String,java.lang.String,com.azure.data.schemaregistry.models.SchemaFormat)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#getSchemaProperties(String, String, String, SchemaFormat)\"></xref> is a non-blocking call, the program will move onto the next line of code after setting up the async operation.\n\n```java\nString schema = \"{\\\"type\\\":\\\"enum\\\",\\\"name\\\":\\\"TEST\\\",\\\"symbols\\\":[\\\"UNIT\\\",\\\"INTEGRATION\\\"]}\";\n client.getSchemaProperties(\"{schema-group}\", \"{schema-name}\", schema, SchemaFormat.AVRO)\n .subscribe(properties -> {\n System.out.println(\"Schema id: \" + properties.getId());\n System.out.println(\"Format: \" + properties.getFormat());\n System.out.println(\"Version: \" + properties.getVersion());\n }, error -> {\n System.err.println(\"Error occurred getting schema: \" + error);\n }, () -> {\n System.out.println(\"Get schema completed.\");\n });\n```\n\n**Sample: Get a schema with its HTTP response**\n\nThe following code sample demonstrates how to get a schema using its group name, schema name, and version number. In addition, it gets the underlying HTTP response that backs this service call. This is useful in cases where customers want more insight into the HTTP request/response. <xref uid=\"com.azure.data.schemaregistry.SchemaRegistryAsyncClient.getSchemaWithResponse*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#getSchemaWithResponse(String, String, int, Context)\"></xref> is a non-blocking call, the program will move onto the next line of code after setting up the async operation.\n\n```java\nclient.getSchemaWithResponse(\"{group-name}\",\n \"{schema-name}\", 1, Context.NONE)\n .subscribe(response -> {\n System.out.println(\"Headers in HTTP response: \");\n\n for (HttpHeader header : response.getHeaders()) {\n System.out.printf(\"%s: %s%n\", header.getName(), header.getValue());\n }\n\n SchemaRegistrySchema schema = response.getValue();\n\n System.out.printf(\"Schema id: %s, schema format: %s%n\", schema.getProperties().getId(),\n schema.getProperties().getFormat());\n System.out.println(\"Schema contents: \" + schema.getDefinition());\n }, error -> {\n System.err.println(\"Error occurred getting schema: \" + error);\n }, () -> {\n System.out.println(\"Get schema with response completed.\");\n });\n```\n\n\n[managed identity]: https://learn.microsoft.com/azure/active-directory/managed-identities-azure-resources/\n[Azure Identity documentation]: https://learn.microsoft.com/java/api/overview/azure/identity-readme"
metadata: {}
package: "com.azure.data.schemaregistry"
artifact: com.azure:azure-data-schemaregistry:1.4.9