The demo in this repo is serializing a string value, but in real world, it is more common to serialize JSON value.
I saw many people including me met issues, and took me some time to succeed.
So just want to share a working demo of JSON value serialization in AVRO using C language. ☺️
Set Up
I registered schema at Confluent Schema Registry by
Introduction
The demo in this repo is serializing a string value, but in real world, it is more common to serialize JSON value. I saw many people including me met issues, and took me some time to succeed. So just want to share a working demo of JSON value serialization in AVRO using C language. ☺️
Set Up
I registered schema at Confluent Schema Registry by
Code
main.c
config.c
config.ini
CMakeList.txt
Note I am on macOS, so I installed
Result
I deployed open source Redpanda Console and Confluent Schema Registry, you can see Redpanda Console can deserialize successfully:
Notes
avro_schema_t schema = serdes_schema_avro(serdes_schema);
is important.Without it, the data will not be serialized correctly: