A lib which helps you generate asyncapi.yaml
from your Java code based on annotations.
- Include the dependencies in your
pom.xml
<dependencies>
<dependency>
<groupId>lu.greenhalos</groupId>
<artifactId>j2asyncapi-annotation</artifactId>
<version>${j2asyncapi.version}</version>
</dependency>
<dependency>
<groupId>lu.greenhalos</groupId>
<artifactId>j2asyncapi-processor</artifactId>
<version>${j2asyncapi.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
- Copy this test from this Repository to your code base
- Change
ExampleBaseApplication.class
with a valid base class of yours e.g. your SpringBootApplication class with the main method. - Change the constant
DOCS_TARGET
to your needs. - Annotate a method which is a publisher e.g. a methode which is already annotated with
@RabbitListener
with the j2asyncapi annotation@AsyncApi
:
class Listener {
@AsyncApi(
type = LISTENER, exchange = "exchange", routingKey = "routing.key", payload = ExampleListenerMessage.class,
description = "Description explaining exactly what happens here"
)
@RabbitListener(queues = "${some.long.path.to.the.queue.name}")
public void on(Message message) {
// do your stuff
}
}
- Run the copied test. The resulting asyncapi.yml is generated to your
DOCS_TARGET
.
🥁 it is a simple a running:
./mvnw clean verify # or install in case you want to publish it to you local .m2 repository
- @JsonIgnore
- process java.util.Locale
- Statistics about schemas