Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Latest commit

 

History

History
65 lines (47 loc) · 2.31 KB

quickstart.md

File metadata and controls

65 lines (47 loc) · 2.31 KB

Getting started

Below is an example of how you can install and set up your service.

  1. Use the spring initalizer and create a Spring Boot application with Spring Cloud Stream dependencies https://start.spring.io
  2. Add the digiwf-asyncapi-docs-starter dependency.

With Maven:

<dependency>
     <groupId>io.muenchendigital.digiwf</groupId>
     <artifactId>digiwf-asyncapi-docs-starter</artifactId>
     <version>${digiwf.version}</version>
</dependency>

With Gradle:

implementation group: 'io.muenchendigital.digiwf', name: 'digiwf-asyncapi-docs-starter', version: '${digiwf.version}'
  1. Add the kafka binder (see Spring Cloud Stream).

Maven:

<dependency>
  <groupId>org.springframework.cloud</groupId>
  <artifactId>spring-cloud-stream-binder-kafka</artifactId>
</dependency>

Gradle:

implementation group: 'org.springframework.cloud', name: 'spring-cloud-stream-binder-kafka'
  1. Add properties for spring cloud stream consumers and producers to application.properties
spring.cloud.stream.default-binder=kafka
spring.cloud.stream.kafka.binder.brokers=localhost:9092
spring.cloud.function.definition=receiveMessage
spring.cloud.stream.bindings.receiveMessage-in-0.destination=kafka-demo-receive-message,kafka-demo-test1
spring.cloud.stream.bindings.receiveMessage-in-0.group=kafka-demo
  1. Setup the base package, version and title of docs for your application in the application.properties. For example
io.muenchendigital.digiwf.docs.enabled=true
io.muenchendigital.digiwf.docs.basePackage=io.muenchendigital.digiwf
io.muenchendigital.digiwf.docs.version=1.0.0
io.muenchendigital.digiwf.docs.title=kafka-example
  1. Annotate your spring cloud functions with the @DocumentAsyncAPI annotation. For consumer and producer functions provide the payload to the annotation, e.g. @DocumentAsyncAPI(payload = YourClass.class). If you use a function router provide additionally the type header, e.g. @DocumentAsyncAPI(payload = YourClass.class, functionRouter = true, typeHeader = "yourTypeHeader").

  2. Check out the documentation at http://localhost:8080/springwolf/asyncapi-ui.html

For more information and code examples see documentation.md