Ekinlikler
Power BI DataViz Dünya Şampiyonası
14 Şub 16 - 31 Mar 16
4 giriş şansıyla bir konferans paketi kazanabilir ve Las Vegas'taki LIVE Grand Finale'e gidebilirsiniz
Daha fazla bilgi edininBu tarayıcı artık desteklenmiyor.
En son özelliklerden, güvenlik güncelleştirmelerinden ve teknik destekten faydalanmak için Microsoft Edge’e yükseltin.
Azure Schema Registry Json Schema is a serializer and deserializer library for JSON data format that is integrated with Azure Schema Registry hosted in Azure Event Hubs, providing schema storage, versioning, and management. This package provides a serializer capable of serializing and deserializing payloads containing Schema Registry schema identifiers and JSON encoded data.
Source code | Package (Maven) | API reference documentation | Product Documentation | Samples
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-data-schemaregistry-jsonschema</artifactId>
<version>1.0.0</version>
</dependency>
The SchemaRegistryJsonSchemaSerializer
instance is the main class that provides APIs for serializing and
deserializing JSON schema format. The JSON schema is stored and retrieved from the Schema Registry service
through the SchemaRegistryAsyncClient
. So, before we create the serializer, we should create the client.
In order to interact with the Azure Schema Registry service, you'll need to create an instance of the
SchemaRegistryAsyncClient
class through the SchemaRegistryClientBuilder
. You will need the Schema Registry endpoint.
You can authenticate with Azure Active Directory using the Azure Identity library. Note that regional endpoints do not support AAD authentication. Create a custom subdomain for your resource in order to use this type of authentication.
To use the DefaultAzureCredential provider shown below, or other credential providers provided
with the Azure SDK, please include the azure-identity
package:
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.13.3</version>
</dependency>
You will also need to register a new AAD application and grant access to Schema Registry service.
TokenCredential tokenCredential = new DefaultAzureCredentialBuilder().build();
JsonSchemaGenerator jsonSchemaGenerator = null;
// {schema-registry-endpoint} is the fully qualified namespace of the Event Hubs instance. It is usually
// of the form "{your-namespace}.servicebus.windows.net"
SchemaRegistryAsyncClient schemaRegistryAsyncClient = new SchemaRegistryClientBuilder()
.fullyQualifiedNamespace("{your-event-hubs-namespace}.servicebus.windows.net")
.credential(tokenCredential)
.buildAsyncClient();
SchemaRegistryJsonSchemaSerializer serializer = new SchemaRegistryJsonSchemaSerializerBuilder()
.schemaRegistryClient(schemaRegistryAsyncClient)
.schemaGroup("{schema-group}")
.jsonSchemaGenerator(jsonSchemaGenerator)
.buildSerializer();
This library provides a serializer, SchemaRegistryJsonSchemaSerializer
. The
SchemaRegistryJsonSchemaSerializer
utilizes a SchemaRegistryAsyncClient
to construct messages using a wire format
containing schema information such as a schema ID. This library allows users to serialize, deserialize, register, and
validate JSON objects by plugging in a JSON schema implementation.
Serialize a POJO object, Address, and register the matching JSON schema if
SchemaRegistryJsonSchemaSerializerBuilder.autoRegisterSchema(boolean)
is set to true
in when creating the
serializer.
Address address = new Address();
address.setNumber(105);
address.setStreetName("1st");
address.setStreetType("Street");
EventData eventData = serializer.serialize(address, TypeReference.createInstance(EventData.class));
The type Address
is available in the test package
com.azure.data.schemaregistry.jsonschema.Address
.
Deserialize a Schema Registry-compatible JSON payload into a strongly-type object and validate it against its JSON schema.
SchemaRegistryJsonSchemaSerializer serializer = createSerializer();
MessageContent message = getSchemaRegistryJSONMessage();
Address address = serializer.deserialize(message, TypeReference.createInstance(Address.class));
Azure SDKs for Java offer a consistent logging story to help aid in troubleshooting application errors and expedite their resolution. The logs produced will capture the flow of an application before reaching the terminal state to help locate the root issue. View the logging wiki for guidance about enabling logging.
More samples can be found here.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Azure SDK for Java geri bildirimi
Azure SDK for Java, açık kaynak bir projedir. Geri bildirim sağlamak için bir bağlantı seçin:
Ekinlikler
Power BI DataViz Dünya Şampiyonası
14 Şub 16 - 31 Mar 16
4 giriş şansıyla bir konferans paketi kazanabilir ve Las Vegas'taki LIVE Grand Finale'e gidebilirsiniz
Daha fazla bilgi edinin