### YamlMime:JavaType uid: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient" fullName: "com.azure.data.schemaregistry.SchemaRegistryAsyncClient" name: "SchemaRegistryAsyncClient" nameWithType: "SchemaRegistryAsyncClient" summary: " is an HTTP-based client that interacts with Azure Schema Registry service to store and retrieve schemas on demand." inheritances: - "" inheritedClassMethods: - classRef: "java.lang.Object" methodsRef: - "clone" - "equals" - "finalize" - "getClass" - "hashCode" - "notify" - "notifyAll" - "toString" - "wait" - "wait" - "wait" 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: "String" - 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: "String" syntax: "public Mono getSchema(String schemaId)" desc: "Gets the schema properties of the schema associated with the unique schema id." returns: description: "The associated with the given schemaId." type: "Mono<>" - 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: "String" - description: "Name of the schema" name: "schemaName" type: "String" - description: "Version of schema" name: "schemaVersion" type: "" syntax: "public Mono 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 matching the parameters." type: "Mono<>" - 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: "String" - description: "The schema name." name: "name" type: "String" - description: "The string representation of the schema." name: "schemaDefinition" type: "String" - description: "The serialization type of this schema." name: "format" type: "" syntax: "public Mono 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: "Mono<>" - 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: "String" - description: "The schema name." name: "name" type: "String" - description: "The string representation of the schema." name: "schemaDefinition" type: "String" - description: "The serialization type of this schema." name: "format" type: "" syntax: "public Mono> 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: "Mono<<>>" - 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: "String" syntax: "public Mono> getSchemaWithResponse(String schemaId)" desc: "Gets the schema properties of the schema associated with the unique schema id." returns: description: "The associated with the given schemaId along with the HTTP response." type: "Mono<<>>" - 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: "String" - description: "Name of the schema" name: "schemaName" type: "String" - description: "Version of schema" name: "schemaVersion" type: "" syntax: "public Mono> 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 matching the parameters." type: "Mono<<>>" - 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: "String" - description: "The schema name." name: "name" type: "String" - description: "The string representation of the schema." name: "schemaDefinition" type: "String" - description: "The serialization type of this schema." name: "format" type: "" syntax: "public Mono 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:\n\n * **does not exist** with the same `groupName`, `name`, `format`, and `schemaDefinition`, it is added to the Schema Registry Instance and assigned a new schema id.\n * exists with the same `groupName`, `name`, `format`, and `schemaDefinition`, the id of that existing schema is returned.\n * exists with the same `groupName`, `name`, and `format` but the `schemaDefinition` is different, it is considered a new version. A new schema id is assigned to the schema and its schema id is returned." returns: description: "The of a successfully registered schema." type: "Mono<>" - 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: "String" - description: "The schema name." name: "name" type: "String" - description: "The string representation of the schema." name: "schemaDefinition" type: "String" - description: "The serialization type of this schema." name: "format" type: "" syntax: "public Mono> 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:\n\n * **does not exist** with the same `groupName`, `name`, `format`, and `schemaDefinition`, it is added to the Schema Registry Instance and assigned a new schema id.\n * exists with the same `groupName`, `name`, `format`, and `schemaDefinition`, the id of that existing schema is returned.\n * exists with the same `groupName`, `name`, and `format` but the `schemaDefinition` is different, it is considered a new version. A new schema id is assigned to the schema and its schema id is returned." returns: description: "The schema properties on successful registration of the schema." type: "Mono<<>>" type: "class" desc: " 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 **\n\nThe following code sample demonstrates the creation of the asynchronous client . 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://.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. 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 when a schema is registered or using . Reactive operations must be subscribed to; this kicks off the operation. 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. 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. 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}\", \"{schema-name}\", 1)\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.5.1