{"id":27268777,"url":"https://github.com/dogusteknoloji/springkafkadoc","last_synced_at":"2026-03-06T05:09:29.216Z","repository":{"id":65603036,"uuid":"593749720","full_name":"DogusTeknoloji/springkafkadoc","owner":"DogusTeknoloji","description":"Auto Generated Kafka Documentation for Spring Boot","archived":false,"fork":false,"pushed_at":"2023-03-02T08:00:05.000Z","size":96,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2023-03-09T23:32:19.209Z","etag":null,"topics":["auto-documentation","kafka","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DogusTeknoloji.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2023-01-26T18:54:28.000Z","updated_at":"2023-02-28T15:13:39.000Z","dependencies_parsed_at":"2023-02-16T18:15:54.953Z","dependency_job_id":null,"html_url":"https://github.com/DogusTeknoloji/springkafkadoc","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DogusTeknoloji%2Fspringkafkadoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DogusTeknoloji%2Fspringkafkadoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DogusTeknoloji%2Fspringkafkadoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DogusTeknoloji%2Fspringkafkadoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DogusTeknoloji","download_url":"https://codeload.github.com/DogusTeknoloji/springkafkadoc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248384073,"owners_count":21094669,"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","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":["auto-documentation","kafka","spring-boot"],"created_at":"2025-04-11T11:32:23.622Z","updated_at":"2026-03-06T05:09:29.062Z","avatar_url":"https://github.com/DogusTeknoloji.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Kafka Documentation\nThis tool is created for auto generated kafka documentation with spring projects. YAML/JSON document is built in Async API format.\n\n## How to use\n- Implement these to build.gradle.kts.\n```\nmaven { url = uri(\"https://jitpack.io\") }\n```\n\n```\nimplementation(\"com.github.DogusTeknoloji:springkafkadoc:1.0.4\")\n```\n\n- Add asyncapi configuration file\n\n``` kotlin\n@Configuration\n@EnableAsyncApi\nclass AsyncApiConfiguration {\n\n    @Bean\n    fun asyncApiDocket(): AsyncApiDocket {\n\n        val info = Info.builder()\n            .version(\"1.0.0\")\n            .title(\"ZubizuLF Customer API\")\n            .build()\n\n        val kafkaServer = Server.builder()\n            .protocol(\"kafka\")\n            .url(BOOTSTRAP_SERVERS)\n            .build()\n\n        return AsyncApiDocket.builder()\n            .consumerBasePackage(KAFKA_CONSUMER_BASE_PACKAGE)\n            .producerBasePackage(KAFKA_PRODUCER_BASE_PACKAGE)\n            .info(info)\n            .server(\"kafka\", kafkaServer)\n            .build()\n    }\n\n    private companion object {\n        const val BOOTSTRAP_SERVERS = \"0.0.0.0:9092\"\n        const val KAFKA_CONSUMER_BASE_PACKAGE = \"com.dteknoloji.*.consumer\"\n        const val KAFKA_PRODUCER_BASE_PACKAGE = \"com.dteknoloji.*.producer\"\n    }\n}\n```\n\nConsumers are included in the consumer package, and producer in the producer package. A project does not have to be both a consumer and a producer. \nEven if it's one of the two, this tool works properly.\n\nIn order for this tool to work properly, consumers and producers must be as follows.\n\nConsumer example:\n\n``` kotlin\n@Component\nclass CustomerCreatedEventConsumer {\n\n    @KafkaListener(topicPattern = \"\\${kafka.topics.customerCreated}\")\n    fun receive(@Payload payload: CustomerCreatedEvent) {\n        // TODO\n    }\n}\n```\n\nProducer example:\n\n``` kotlin\n@Component\nclass CustomerCreatedEventProducer {\n\n    @AsyncApiDocProducer(\"customerCreated\")\n    fun send(@Payload payload: CustomerCreatedEvent) {\n        // TODO\n    }\n}\n```\n\nIn the added configuration file, we specify which package the consumers and producers have. \nThe tool detects the consumers and producers in the project by finding the classes that use the @Component annotation.\n\nNormally, an annotation is not required for the methods or payloads of the producers. \nBut, we use kafka's @Payload annotation for payloads to create the producer document.\nIn addition, we use the @AsyncApiDocProducer annotation created in the tool to understand which topic the events are thrown to.\n\nWe use the topicPattern parameter, which we want to pull the consumer topic names from the config files. \nThere is a rule to get the last word here. \nThere is a topicPattern parameter in the @AsyncApiDocProducer annotation, but whatever value is given to that parameter, that value is used as it is.\n\n## Endpoints\nIn this project, there are two endpoints.\n- GET /springkafkadoc/json\n- GET /springkafkadoc/yaml\n\nBy using these endpoints, you can get AsyncAPI documents in JSON/YAML formats.\n\nSample of YAML:\n\n``` yaml\nasyncapi: \"2.0.0\"\ninfo:\n  title: \"Customer\"\n  version: \"1.0.0\"\n  description: \"Nice, short desc\"\nservers:\n  kafka:\n    url: \"ip-of-service:port\"\n    protocol: \"kafka\"\nchannels:\n  customerCreated_publish:\n    publish:\n      operationId: \"customerCreated_publish_receive\"\n      description: \"Auto-generated description\"\n      bindings:\n        kafka:\n          groupId:\n            type: \"string\"\n            enum:\n            - \"customer\"\n      message:\n        name: \"CustomerCreatedEvent\"\n        title: \"CustomerCreatedEvent\"\n        payload:\n          $ref: \"#/components/schemas/CustomerCreatedEvent\"\n        headers:\n          $ref: \"#/components/schemas/HeadersNotDocumented\"\n    bindings:\n      kafka: {}\n  customerDeleted_publish:\n    publish:\n      operationId: \"customerDeleted_publish_receive\"\n      description: \"Auto-generated description\"\n      bindings:\n        kafka:\n          groupId:\n            type: \"string\"\n            enum:\n            - \"customer\"\n      message:\n        name: \"CustomerDeletedEvent\"\n        title: \"CustomerDeletedEvent\"\n        payload:\n          $ref: \"#/components/schemas/CustomerDeletedEvent\"\n        headers:\n          $ref: \"#/components/schemas/HeadersNotDocumented\"\n    bindings:\n      kafka: {}\n  paymentRegistered_publish:\n    publish:\n      operationId: \"paymentRegistered_publish_receive\"\n      description: \"Auto-generated description\"\n      bindings:\n        kafka:\n          groupId:\n            type: \"string\"\n            enum:\n            - \"customer\"\n      message:\n        name: \"PaymentRegisteredEvent\"\n        title: \"PaymentRegisteredEvent\"\n        payload:\n          $ref: \"#/components/schemas/PaymentRegisteredEvent\"\n        headers:\n          $ref: \"#/components/schemas/HeadersNotDocumented\"\n    bindings:\n      kafka: {}\ncomponents:\n  schemas:\n    CustomerCreatedEvent:\n      type: \"object\"\n      exampleSetFlag: true\n    HeadersNotDocumented:\n      type: \"object\"\n      properties: {}\n      example: {}\n      exampleSetFlag: true\n      types:\n      - \"object\"\n    CustomerDeletedEvent:\n      type: \"object\"\n      exampleSetFlag: true\n    PaymentRegisteredEvent:\n      type: \"object\"\n      properties:\n        transactionId:\n          type: \"string\"\n          format: \"uuid\"\n          exampleSetFlag: false\n          types:\n          - \"string\"\n        customerId:\n          type: \"string\"\n          format: \"uuid\"\n          exampleSetFlag: false\n          types:\n          - \"string\"\n        totalPaidAmount:\n          type: \"number\"\n          format: \"double\"\n          exampleSetFlag: false\n          types:\n          - \"number\"\n        itemList:\n          type: \"object\"\n          additionalProperties:\n            type: \"integer\"\n            format: \"int32\"\n            exampleSetFlag: false\n            types:\n            - \"integer\"\n          exampleSetFlag: false\n          types:\n          - \"object\"\n          jsonSchema:\n            type: \"object\"\n      example:\n        transactionId: \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n        customerId: \"3fa85f64-5717-4562-b3fc-2c963f66afa6\"\n        totalPaidAmount: 1.100000023841858\n        itemList:\n          additionalProp1: 0\n          additionalProp2: 0\n          additionalProp3: 0\n      exampleSetFlag: true\ntags: []\n```\n\n## References\n[Springwolf](https://github.com/springwolf/springwolf-core)\n\n[Async API](https://www.asyncapi.com/)\n\nThis tool is very inspired by the springwolf project, which is an open source tool. ❤️\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdogusteknoloji%2Fspringkafkadoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdogusteknoloji%2Fspringkafkadoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdogusteknoloji%2Fspringkafkadoc/lists"}