Quickstart
The following instructions are for Kafka services - but amqp services configuration is almost identical. Check out the example project for complete examples.
1. Add dependencies
Add the following dependencies:
- Groovy
- Maven
dependencies {
// Provides the documentation API
implementation 'io.github.springwolf:springwolf-kafka:0.12.0'
// Provides the UI - optional (recommended)
runtimeOnly 'io.github.springwolf:springwolf-ui:0.8.0'
}
<dependencies>
<!-- Provides the documentation API -->
<dependency>
<groupId>io.github.springwolf</groupId>
<artifactId>springwolf-kafka</artifactId>
<version>0.12.0</version>
</dependency>
<!-- Provides the UI - optional (recommended) -->
<dependency>
<groupId>io.github.springwolf</groupId>
<artifactId>springwolf-ui</artifactId>
<version>0.8.0</version>
</dependency>
</dependencies>
Latest version:
2. Configure properties
Add the following to your application.properties:
springwolf.docket.base-package=io.github.stavshamir.springwolf.example.consumers
springwolf.docket.info.title=${spring.application.name}
springwolf.docket.info.version=1.0.0
springwolf.docket.servers.kafka.protocol=kafka
springwolf.docket.servers.kafka.url=${kafka.bootstrap.servers:localhost:29092}
Make sure to change the value of springwolf.docket.base-package to the package containing your listeners, so that springwolf will automatically pick them up.
3. View the docs
Start the application and open the urls in your browser:
- Json:
<host>:<port>/springwolf/docs - Yaml:
<host>:<port>/springwolf/docs.yaml - UI:
<host>:<port>/springwolf/asyncapi-ui.html
If you configured a different context path in your application, make sure to prepend it to springwolf urls, i.e. <host>:<port>/<context-path>/springwolf/asyncapi-ui.html
Examples
- amqp: https://github.com/springwolf/springwolf-core/tree/master/springwolf-examples/springwolf-amqp-example
- spring-cloud-stream: https://github.com/springwolf/springwolf-core/tree/master/springwolf-examples/springwolf-cloud-stream-example
- kafka: https://github.com/springwolf/springwolf-core/tree/master/springwolf-examples/springwolf-kafka-example