{"id":16323763,"url":"https://github.com/shavo007/kafka-tutorial","last_synced_at":"2026-04-16T19:41:20.091Z","repository":{"id":45893785,"uuid":"409411660","full_name":"shavo007/kafka-tutorial","owner":"shavo007","description":"kafka demo","archived":false,"fork":false,"pushed_at":"2021-11-30T01:28:45.000Z","size":3108,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-14T15:16:47.329Z","etag":null,"topics":["avro","aysncapi","docker","java","kafka","kafka-connect","kafka-streams","kotlin","ksqldb","microcks","schema-registry"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shavo007.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-23T01:45:42.000Z","updated_at":"2021-12-07T12:20:08.000Z","dependencies_parsed_at":"2022-09-24T18:43:23.293Z","dependency_job_id":null,"html_url":"https://github.com/shavo007/kafka-tutorial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shavo007/kafka-tutorial","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shavo007%2Fkafka-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shavo007%2Fkafka-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shavo007%2Fkafka-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shavo007%2Fkafka-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shavo007","download_url":"https://codeload.github.com/shavo007/kafka-tutorial/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shavo007%2Fkafka-tutorial/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269201296,"owners_count":24377460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avro","aysncapi","docker","java","kafka","kafka-connect","kafka-streams","kotlin","ksqldb","microcks","schema-registry"],"created_at":"2024-10-10T22:55:35.761Z","updated_at":"2026-04-16T19:41:15.052Z","avatar_url":"https://github.com/shavo007.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kafka tutorial\n\n```bash\n├── asyncapi #async api example with microcks\n├── avro #avro schema consumer/producer example with schema registry\n├── connect #connect with multiple examples\n├── kotlin #kotlin producer/consumer example\n└── ksqldb #database for stream processing apps\n└── streams #streams examples (basic/serdes/ktable)\n```\n\n![The San Juan Mountains are beautiful!](/assets/images/ksqldb-kafka-streams-core-kafka-stack.png)\n\n## Steps\n\n`docker-compose up -d`\n\n```bash\n#~/.confluent/java.config\n# Kafka\nbootstrap.servers=localhost:9092\n\n# Confluent Schema Registry\nschema.registry.url=http://localhost:8081\n```\n\n### Create a topic\n\n```bash\ndocker exec broker \\\nkafka-topics --bootstrap-server broker:9092 \\\n             --create \\\n             --topic quickstart\n\n```\n\n### Producer example\n\n```bash\ncd kotlin\n./gradlew runApp -PmainClass=\"io.confluent.examples.clients.cloud.ProducerExample\"      -PconfigPath=\"$HOME/.confluent/java.config\"      -Ptopic=\"test1\"\n```\n\n```bash\nkcat -b localhost:9092 -t test1 -C \\\n  -f '\\nKey (%K bytes): %k\n  Value (%S bytes): %s\n  Timestamp: %T\n  Partition: %p\n  Offset: %o\n  Headers: %h\\n'\n```\n\n### Consumer example\n\n```bash\n./gradlew runApp -PmainClass=\"io.confluent.examples.clients.cloud.ConsumerExample\"\\\n     -PconfigPath=\"$HOME/.confluent/java.config\"\\\n     -Ptopic=\"test1\"\n```\n\n### Streams example\n\n```bash\n./gradlew runApp -PmainClass=\"io.confluent.examples.clients.cloud.StreamsExample\" \\\n     -PconfigPath=\"$HOME/.confluent/java.config\" \\\n     -Ptopic=\"test1\"\n```\n\n## kafka without zookeeper and schema registry\n\nhttps://docs.confluent.io/platform/current/tutorials/build-your-own-demos.html#kraft\nhttps://docs.confluent.io/platform/current/schema-registry/schema_registry_onprem_tutorial.html\n\n```bash\ngit clone https://github.com/confluentinc/cp-all-in-one.git\ncd cp-all-in-one/cp-all-in-one-kraft\ngit checkout 6.2.0-post\n\n#local file\ndocker-compose -f docker-compose-kraft.yaml up  -d\n\n```\n\n## Avro example and schema registry\n\n```bash\n#producer\ncd avro\nmvn exec:java -Dexec.mainClass=io.confluent.examples.clients.basicavro.ProducerExample \\\n  -Dexec.args=\"$HOME/.confluent/java.config\"\n\n#view latest schema\ncurl --silent -X GET http://localhost:8081/subjects/transactions-value/versions/latest | jq .\ncurl --silent -X GET http://localhost:8081/schemas/ids/1 | jq .\n\n#consumer\nmvn exec:java -Dexec.mainClass=io.confluent.examples.clients.basicavro.ConsumerExample \\\n  -Dexec.args=\"$HOME/.confluent/java.config\"\n\n```\n\n### Schema evolution and compatability\n\n```bash\n#checking backwards compatiability with the latest registered schema for payments\n\nmvn io.confluent:kafka-schema-registry-maven-plugin:test-compatibility\n#you will get an error due to new field region\n[ERROR] Schema kafka-tutorial/avro/src/main/resources/avro/io/confluent/examples/clients/basicavro/Payment2a.avsc is not compatible with subject(transactions-value) with error [Incompatibility{type:READER_FIELD_MISSING_DEFAULT_VALUE, location:/fields/2, message:region, reader:{\"type\":\"record\",\"name\":\"Payment\",\"namespace\":\"io.confluent.examples.clients.basicavro\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"amount\",\"type\":\"double\"},{\"name\":\"region\",\"type\":\"string\"}]}, writer:{\"type\":\"record\",\"name\":\"Payment\",\"namespace\":\"io.confluent.examples.clients.basicavro\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"amount\",\"type\":\"double\"}]}}]\n```\n\nNow register the new version of schema with default value for field `region`\n\n```bash\ncurl -X POST -H \"Content-Type: application/vnd.schemaregistry.v1+json\" \\\n  --data '{\"schema\": \"{\\\"type\\\":\\\"record\\\",\\\"name\\\":\\\"Payment\\\",\\\"namespace\\\":\\\"io.confluent.examples.clients.basicavro\\\",\\\"fields\\\":[{\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\"},{\\\"name\\\":\\\"amount\\\",\\\"type\\\":\\\"double\\\"},{\\\"name\\\":\\\"region\\\",\\\"type\\\":\\\"string\\\",\\\"default\\\":\\\"\\\"}]}\"}' \\\n  http://localhost:8081/subjects/transactions-value/versions\n\n  #view the latest subject\n  curl --silent -X GET http://localhost:8081/subjects/transactions-value/versions/latest | jq .\n\n  #get global compatiability type\n  curl --silent -X GET http://localhost:8081/config | jq .\n\n  curl -X PUT -H \"Content-Type: application/vnd.schemaregistry.v1+json\" \\\n       --data '{\"compatibility\": \"BACKWARD_TRANSITIVE\"}' \\\n       http://localhost:8081/config/transactions-value\n\ncurl --silent -X GET http://localhost:8081/config/transactions-value | jq .\n```\n\n## Resources\n\n- \u003chttps://docs.confluent.io/platform/current/tutorials/examples/clients/docs/kotlin.html\u003e\n- \u003chttps://www.confluent.io/learn/kafka-tutorial/\u003e\n- \u003chttps://www.asyncapi.com/blog/openapi-vs-asyncapi-burning-questions\u003e\n\n## TODO\n\n- linting async API via spectral\n- microcks and async API https://microcks.io/blog/async-features-with-docker-compose/\n- https://microcks.io/documentation/guides/avro-messaging/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshavo007%2Fkafka-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshavo007%2Fkafka-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshavo007%2Fkafka-tutorial/lists"}