Swagger documentation for Kafka Listener [closed]
Asked Answered
U

2

15

I have used Swagger to generate a document for rest API, but I am building Kafka listener and wanted to generate a document for it. Do we have any possibility using Swagger or something similar?

Thanks, Manish

Unswerving answered 22/2, 2018 at 15:31 Comment(5)
Exactly what are you trying to document? A REST API is something that you might want to publish for external users to use. A Kafka listener does not hava a public API, it's just an internal implementation that receives records from Kafka.Miscible
Interesting question. Messaging (via JMS with ActiveMQ) is the main way of communication between our services. We document all our listeners manually which is a great pain. I would love to have a "Swagger for messaging".Quincunx
Hi @GaryRussell, our core domain layer is sending a different specialized message to the different topic, and this becomes a contract for another service, of what they are going to receive it.Unswerving
I am not sure it's entirely relevant to your requirements, but you might find Spring Cloud Contract interesting.Miscible
thanks @GaryRussell I will have a look into it.Unswerving
A
2

I have faced the same need, and decided to create something myself. I call it swagger4kafka, and it works very similar to swagger, but it documents @KafkaListener annotated methods instead of RestController methods.

Its source is hosted in github: swagger4kafka repository In the readme section you can find how to use it.

I would not say it is production ready yet, but I think it can be quite useful for internal use.

Note:
'swagger4kafka' is now called 'Springwolf' (and also support RabbitMQ)

Adductor answered 12/2, 2019 at 11:42 Comment(0)
D
2

Stav Shamir has actually created an improved open source solution called Springwolf.

It does auto-detect the KafkaListener annotations and creates AsyncAPI compliant documentation for the asynchronous world (i.e. Kafka) - just like Swagger does for synchronous REST APIs.

Dovetail answered 25/7, 2023 at 9:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.