Skip to content

Commit fb99619

Browse files
author
Jill Grant
authored
Merge pull request #235915 from kasun04/main
Add JSON schema support and restructure SR docs
2 parents 79d5730 + 9813d1e commit fb99619

14 files changed

+559
-102
lines changed

articles/event-hubs/TOC.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@
106106
href: event-hubs-dedicated-overview.md
107107
- name: Compare tiers
108108
href: compare-tiers.md
109+
- name: Schema Registry
110+
items:
111+
- name: Schema Registry concepts
112+
href: schema-registry-concepts.md
113+
- name: Client-side schema enforcement
114+
href: schema-registry-client-side-enforcement.md
109115
- name: Event processing using SDKs
110116
items:
111117
- name: Event processor host (legacy SDK)
@@ -232,6 +238,22 @@
232238
href: ../stream-analytics/no-code-filter-ingest-data-explorer.md?toc=/azure/event-hubs/toc.json
233239
- name: Process data using Azure Stream Analytics
234240
href: process-data-azure-stream-analytics.md
241+
242+
- name: Use Schema Registry
243+
items:
244+
- name: Client-side schema enforcement
245+
items:
246+
- name: Using Avro schema
247+
items:
248+
- name: Avro schema with Apache Kafka applications
249+
href: schema-registry-kafka-java-send-receive-quickstart.md
250+
- name: Avro schema with Event Hubs SDK(AMQP)
251+
href: schema-registry-dotnet-send-receive-quickstart.md
252+
- name: Using JSON Schema
253+
items:
254+
- name: JSON Schema with Apache Kafka applications
255+
href: schema-registry-json-schema-kafka.md
256+
235257
- name: Integrate with Spring framework
236258
items:
237259
- name: Create a Spring Cloud Stream Binder app

articles/event-hubs/authenticate-application.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Azure provides the following Azure built-in roles for authorizing access to Even
2121
- [Azure Event Hubs Data Sender](../role-based-access-control/built-in-roles.md#azure-event-hubs-data-sender): Use this role to give access to Event Hubs resources.
2222
- [Azure Event Hubs Data Receiver](../role-based-access-control/built-in-roles.md#azure-event-hubs-data-receiver): Use this role to give receiving access to Event Hubs resources.
2323

24-
For Schema Registry built-in roles, see [Schema Registry roles](schema-registry-overview.md#azure-role-based-access-control).
24+
For Schema Registry built-in roles, see [Schema Registry roles](schema-registry-concepts.md#azure-role-based-access-control).
2525

2626
> [!IMPORTANT]
2727
> Our preview release supported adding Event Hubs data access privileges to Owner or Contributor role. However, data access privileges for Owner and Contributor role are no longer honored. If you are using the Owner or Contributor role, switch to using the Azure Event Hubs Data Owner role.

articles/event-hubs/authorize-access-azure-active-directory.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Azure provides the following Azure built-in roles for authorizing access to Even
3434
| [Azure Event Hubs Data sender](../role-based-access-control/built-in-roles.md#azure-event-hubs-data-sender) | Use this role to give the send access to Event Hubs resources. |
3535
| [Azure Event Hubs Data receiver](../role-based-access-control/built-in-roles.md#azure-event-hubs-data-receiver) | Use this role to give the consuming/receiving access to Event Hubs resources. |
3636

37-
For Schema Registry built-in roles, see [Schema Registry roles](schema-registry-overview.md#azure-role-based-access-control).
37+
For Schema Registry built-in roles, see [Schema Registry roles](schema-registry-concepts.md#azure-role-based-access-control).
3838

3939
## Resource scope
4040
Before you assign an Azure role to a security principal, determine the scope of access that the security principal should have. Best practices dictate that it's always best to grant only the narrowest possible scope.

articles/event-hubs/create-schema-registry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This article shows you how to create a schema group with schemas in a schema reg
1414

1515
> [!NOTE]
1616
> - The feature isn't available in the **basic** tier.
17-
> - Make sure that you are a member of one of these roles: **Owner**, **Contributor**, or **Schema Registry Contributor**. For details about role-based access control, see [Schema Registry overview](schema-registry-overview.md#azure-role-based-access-control).
17+
> - Make sure that you are a member of one of these roles: **Owner**, **Contributor**, or **Schema Registry Contributor**. For details about role-based access control, see [Schema Registry overview](schema-registry-concepts.md#azure-role-based-access-control).
1818
> - If the event hub is in a **virtual network**, you won't be able to create schemas in the Azure portal unless you access the portal from a VM in the same virtual network.
1919
2020

articles/event-hubs/event-hubs-quickstart-kafka-enabled-event-hubs.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ title: 'Quickstart: Use Apache Kafka with Azure Event Hubs'
33
description: 'This quickstart shows you how to stream data into and from Azure Event Hubs using the Apache Kafka protocol.'
44
ms.topic: quickstart
55
ms.date: 02/07/2023
6+
author: kasun04
7+
ms.author: kindrasiri
68
ms.custom: mode-other, passwordless-java
79
---
810

911
# Quickstart: Stream data with Azure Event Hubs and Apache Kafka
10-
This quickstart shows you how to stream data into and from Azure Event Hubs using the Apache Kafka protocol. You'll not change any code in the sample Kafka producer or consumer apps. You just update the configurations that the clients use to point to an Event Hubs namespace, which exposes a Kafka endpoint. You also don't build and use a Kafka cluster on your own. Instead, you'll use the Event Hubs namespace with the Kafka endpoint.
12+
This quickstart shows you how to stream data into and from Azure Event Hubs using the Apache Kafka protocol. You'll not change any code in the sample Kafka producer or consumer apps. You just update the configurations that the clients use to point to an Event Hubs namespace, which exposes a Kafka endpoint. You also don't build and use a Kafka cluster on your own. Instead, you use the Event Hubs namespace with the Kafka endpoint.
1113

1214
> [!NOTE]
1315
> This sample is available on [GitHub](https://github.com/Azure/azure-event-hubs-for-kafka/tree/master/quickstart/java)
@@ -51,13 +53,13 @@ Azure Event Hubs supports using Azure Active Directory (Azure AD) to authorize r
5153
1. Select the **Azure subscription** that has the VM.
5254
1. For **Managed identity**, select **Virtual machine**
5355
1. Select your virtual machine's managed identity.
54-
1. Click **Select** at the bottom of the page.
56+
1. Select **Select** at the bottom of the page.
5557

5658
:::image type="content" source="./media/event-hubs-quickstart-kafka-enabled-event-hubs/add-vm-identity.png" alt-text="Screenshot showing the Add role assignment -> Select managed identities page.":::
5759
1. Select **Review + Assign**.
5860

5961
:::image type="content" source="./media/event-hubs-quickstart-kafka-enabled-event-hubs/review-assign.png" alt-text="Screenshot showing the Add role assignment page with role assigned to VM's managed identity.":::
60-
1. Restart the VM and log in back to the VM for which you configured the managed identity.
62+
1. Restart the VM and sign in back to the VM for which you configured the managed identity.
6163
1. Clone the [Azure Event Hubs for Kafka repository](https://github.com/Azure/azure-event-hubs-for-kafka).
6264
1. Navigate to `azure-event-hubs-for-kafka/tutorials/oauth/java/managedidentity/consumer`.
6365
1. Switch to the `src/main/resources/` folder, and open `consumer.config`. Replace `namespacename` with the name of your Event Hubs namespace.
165 KB
Loading
190 KB
Loading
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Client-side schema enforcement - Schema Registry
3+
description: This article provides information on using schemas in a schema registry when publishing or consuming events from Azure Event Hubs.
4+
ms.topic: conceptual
5+
ms.date: 04/26/2023
6+
author: kasun04
7+
ms.author: kindrasiri
8+
---
9+
10+
# Client-side schema enforcement
11+
The information flow when you use schema registry is the same for all protocols that you use to publish or consume events from Azure Event Hubs.
12+
13+
The following diagram shows how the information flows when event producers and consumers use Schema Registry with the **Kafka** protocol using **Avro** serialization.
14+
15+
:::image type="content" source="./media/schema-registry-overview/information-flow.svg" alt-text="Image showing the Schema Registry information flow." border="false":::
16+
17+
### Producer
18+
19+
1. Kafka producer application uses `KafkaAvroSerializer` to serialize event data using the specified schema. Producer application provides details of the schema registry endpoint and other optional parameters that are required for schema validation.
20+
1. The serializer looks for the schema in the schema registry to serialize event data. If it finds the schema, then the corresponding schema ID is returned. You can configure the producer application to auto register the schema with the schema registry if it doesn't exist.
21+
1. Then the serializer prepends the schema ID to the serialized data that is published to the Event Hubs.
22+
23+
### Consumer
24+
25+
1. Kafka consumer application uses `KafkaAvroDeserializer` to deserialize data that it receives from the event hub.
26+
1. The deserializer uses the schema ID (prepended by the producer) to retrieve schema from the schema registry.
27+
1. The deserializer uses the schema to deserialize event data that it receives from the event hub.
28+
1. The schema registry client uses caching to prevent redundant schema registry lookups in the future.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: Azure Schema Registry Concepts
3+
description: This article explains concepts for Azure Schema Registry in Azure Event Hubs.
4+
ms.topic: conceptual
5+
ms.date: 04/26/2023
6+
author: kasun04
7+
ms.author: kindrasiri
8+
---
9+
10+
# Schema Registry in Azure Event Hubs
11+
Schema Registry in Azure Event Hubs provides you with a repository to use and manage schemas in schema-driven event streaming scenarios.
12+
13+
## Schema Registry components
14+
15+
An Event Hubs namespace can host schema groups alongside event hubs (or Kafka topics). It hosts a schema registry and can have multiple schema groups. In spite of being hosted in Azure Event Hubs, the schema registry can be used universally with all Azure messaging services and any other message or events broker. Each of these schema groups is a separately securable repository for a set of schemas. Groups can be aligned with a particular application or an organizational unit.
16+
17+
:::image type="content" source="./media/schema-registry-overview/elements.png" alt-text="Diagram that shows the components of Schema Registry in Azure Event Hubs." border="false":::
18+
19+
### Schema groups
20+
Schema group is a logical group of similar schemas based on your business criteria. A schema group can hold multiple versions of a schema. The compatibility enforcement setting on a schema group can help ensure that newer schema versions are backwards compatible.
21+
22+
The security boundary imposed by the grouping mechanism help ensures that trade secrets don't inadvertently leak through metadata in situations where the namespace is shared among multiple partners. It also allows for application owners to manage schemas independent of other applications that share the same namespace.
23+
24+
### Schemas
25+
Schemas define the contract between producers and consumers. A schema defined in an Event Hubs schema registry helps manage the contract outside of event data, thus removing the payload overhead. A schema has a name, type (example: record, array, and so on.), compatibility mode (none, forward, backward, full), and serialization type (only Avro for now). You can create multiple versions of a schema and retrieve and use a specific version of a schema.
26+
27+
### Schema formats
28+
Schema formats are used to determine the manner in which a schema is structured and defined, with each format outlining specific guidelines and syntax for defining the structure of the events that will be used for event streaming.
29+
30+
#### Avro schema
31+
[Avro](https://avro.apache.org/) is a popular data serialization system that uses a compact binary format and provides schema evolution capabilities.
32+
33+
To learn more about using Avro schema format with Event Hubs Schema Registry, see:
34+
- [How to use schema registry with Kafka and Avro](schema-registry-kafka-java-send-receive-quickstart.md)
35+
- [ How to use Schema registry with Event Hubs .NET SDK (AMQP) and Avro.](schema-registry-dotnet-send-receive-quickstart.md)
36+
37+
#### JSON Schema (Preview)
38+
[JSON Schema](https://json-schema.org/) is a standardized way of defining the structure and data types of the events. JSON Schema enables the confident and reliable use of the JSON data format in event streaming.
39+
40+
To learn more about using JSON schema format with Event Hubs Schema Registry, see:
41+
- [How to use schema registry with Kafka and JSON Schema](schema-registry-json-schema-kafka.md)
42+
43+
## Schema evolution
44+
Schemas need to evolve with the business requirement of producers and consumers. Azure Schema Registry supports schema evolution by introducing compatibility modes at the schema group level. When you create a schema group, you can specify the compatibility mode of the schemas that you include in that schema group. When you update a schema, the change should comply with the assigned compatibility mode and then only it creates a new version of the schema.
45+
46+
> [!NOTE]
47+
> Schema evolution is only supported for Avro schema format only.
48+
49+
Azure Schema Registry for Event Hubs support following compatibility modes.
50+
51+
### Backward compatibility
52+
Backward compatibility mode allows the consumer code to use a new version of schema but it can process messages with old version of the schema. When you use backward compatibility mode in a schema group, it allows following changes to be made on a schema.
53+
54+
- Delete fields.
55+
- Add optional fields.
56+
57+
### Forward compatibility
58+
Forward compatibility allows the consumer code to use an old version of the schema but it can read messages with the new schema. Forward compatibility mode allows following changes to be made on a schema.
59+
- Add fields
60+
- Delete optional fields
61+
62+
### No compatibility
63+
When the ``None`` compatibility mode is used, the schema registry doesn't do any compatibility checks when you update schemas.
64+
65+
## Client SDKs
66+
67+
You can use one of the following libraries to include an Avro serializer, which you can use to serialize and deserialize payloads containing Schema Registry schema identifiers and Avro-encoded data.
68+
69+
- [.NET - Microsoft.Azure.Data.SchemaRegistry.ApacheAvro](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro)
70+
- [Java - azure-data-schemaregistry-avro](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/schemaregistry/azure-data-schemaregistry-apacheavro)
71+
- [Python - azure-schemaregistry-avroserializer](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry-avroencoder/)
72+
- [JavaScript - @azure/schema-registry-avro](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/schemaregistry/schema-registry-avro)
73+
- [Apache Kafka](https://github.com/Azure/azure-schema-registry-for-kafka/) - Run Kafka-integrated Apache Avro serializers and deserializers backed by Azure Schema Registry. The Java client's Apache Kafka client serializer for the Azure Schema Registry can be used in any Apache Kafka scenario and with any Apache Kafka® based deployment or cloud service.
74+
- **Azure CLI** - For an example of adding a schema to a schema group using CLI, see [Adding a schema to a schema group using CLI](https://github.com/Azure/azure-event-hubs/tree/master/samples/Management/CLI/AddschematoSchemaGroups).
75+
- **PowerShell** - For an example of adding a schema to a schema group using PowerShell, see [Adding a schema to a schema group using PowerShell](https://github.com/Azure/azure-event-hubs/tree/master/samples/Management/PowerShell/AddingSchematoSchemagroups).
76+
77+
78+
## Limits
79+
For limits (for example: number of schema groups in a namespace) of Event Hubs, see [Event Hubs quotas and limits](event-hubs-quotas.md)
80+
81+
## Azure role-based access control
82+
When accessing the schema registry programmatically, you need to register an application in Azure Active Directory (Azure AD) and add the security principal of the application to one of the following Azure role-based access control (Azure RBAC) roles:
83+
84+
| Role | Description |
85+
| ---- | ----------- |
86+
| Owner | Read, write, and delete Schema Registry groups and schemas. |
87+
| Contributor | Read, write, and delete Schema Registry groups and schemas. |
88+
| [Schema Registry Reader](../role-based-access-control/built-in-roles.md#schema-registry-reader-preview) | Read and list Schema Registry groups and schemas. |
89+
| [Schema Registry Contributor](../role-based-access-control/built-in-roles.md#schema-registry-reader-preview) | Read, write, and delete Schema Registry groups and schemas. |
90+
91+
For instructions on creating registering an application using the Azure portal, see [Register an app with Azure AD](../active-directory/develop/quickstart-register-app.md). Note down the client ID (application ID), tenant ID, and the secret to use in the code.
92+
93+
## Next steps
94+
95+
- To learn how to create a schema registry using the Azure portal, see [Create an Event Hubs schema registry using the Azure portal](create-schema-registry.md).
96+
- See the following **Schema Registry Avro client library** samples.
97+
- [.NET](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/schemaregistry/Microsoft.Azure.Data.SchemaRegistry.ApacheAvro/tests/Samples)
98+
- [Java](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/schemaregistry/azure-data-schemaregistry-apacheavro/src/samples)
99+
- [JavaScript](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/schemaregistry/schema-registry-avro/samples )
100+
- [Python](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/schemaregistry/azure-schemaregistry-avroencoder/samples)
101+
- [Kafka Avro Integration for Azure Schema Registry](https://github.com/Azure/azure-schema-registry-for-kafka/tree/master/csharp/avro/samples)

0 commit comments

Comments
 (0)