How to Add a New Topic Consumer & Producer
- Add new
avsc
file underc_sharp_kafka/Schemas
. Utilize https://toolslick.com/generation/metadata/avro-schema-from-json to convert known JSON schema to avro file - Start all kafka docker containers running with
docker-compose up -d
. Confirm they are up withdocker-compose ps
- Generate
cs
files fromavsc
files using this commmandavrogen -s c_sharp_kafka/Schemas/<new_avsc_schema_file>.avsc .
- Create new consumer and producer classes for your topic under the
c_sharp_kafka/Consumers
&c_sharp_kafka/Producers
folders respectively using the base classes. - Add your new topic to
Program.cs
in the case statements to handle them from program arguments - Test new topic production and consumption by changing your args passed into program
NOTE: If developing locally, you may have to remove any previous iterations of avsc
schemas by running this command curl -X DELETE http://localhost:8081/subjects/<topic-name>-value