I have an event schema stored in JSON format in Azure Event Hubs Schema Registry.
I need to read that schema in my C# code, without hard coding the schema in the code.
Schema needs to be read into a JSON object in the code.
I am looking for some sample code to get started. I have not found anything in the manuals
or elsewhere.
Please help.
2
Answers
Here is an example of how you might achieve this:
Please ensure you have installed the necessary NuGet packages like Azure.Messaging.EventHubs, Azure.Messaging.EventHubs.Producer, Azure.Messaging.EventHubs.Consumer, and Azure.Messaging.EventHubs.SchemaRegistry for this code to work.
This scenario is documented in the Retrieve a schema example in the
Azure.Data.SchemaRegistry
overview:This works no matter the format of the schema, including JSON. More examples and discussion are available in the Schema Registry README and samples.