You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/behind-the-scenes.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,9 @@ The following paragraphs describe how Springwolf works internally.
8
8
9
9
## Big Picture
10
10
When the Spring Boot application is started, Springwolf uses its scanners to find defined consumers and producers within the application.
11
-
Based on the results, the channels/topics are extracted including payload type and merged together into an [AsyncApi conform document](https://www.asyncapi.com/docs/reference/specification/v2.6.0).
11
+
Based on the results, the channels/topics are extracted including payload type and merged together into an [AsyncAPI conform document](https://www.asyncapi.com/docs/reference/specification/v2.6.0).
12
12
13
-
The AsyncApi document is accessible an endpoint.
13
+
The AsyncAPI document is accessible an endpoint.
14
14
When the Springwolf UI is opened, the browser fetches the document and renders it (see demo).
15
15
16
16
When publishing is enabled, the user can publish a message through the UI to another endpoint.
@@ -27,15 +27,15 @@ When building own scanner plugins, your plugin will need to implement the `Chann
27
27
When the same channel/topic is found multiple times, it's merged as well.
28
28
29
29
The result is a [`ChannelItem`](https://www.asyncapi.com/docs/reference/specification/v2.6.0#channelItemObject).
30
-
The `ChannelItem` contains the `Message` for the subscribe and/or publish operation.
30
+
The `ChannelObject` contains the `Message` for the receive and/or send operation.
31
31
32
32
## Building an example payload
33
33
When the scanners scan and build the result, they also extract the payload type.
34
-
The payload is registered in the `SchemasService`, which allows to split the `Message` from the schema definition - within the AsyncAPI doc a `$ref` references is used.
34
+
The payload is registered in the `ComponentsService`, which allows to split the `Message` from the schema definition - within the AsyncAPI doc a `$ref` references is used.
35
35
36
-
Using `swagger-core` any class can be converted into a OpenApi schema.
37
-
The schema is used in the AsyncApi document.
38
-
Additionally, Springwolf generates an example JSON based on the provided schema.
36
+
Using `swagger-core` any class can be converted into an OpenApi schema.
37
+
The schema is [mapped into an AsyncAPI schema](https://www.asyncapi.com/docs/tutorials/getting-started/coming-from-openapi) and included in the AsyncAPI document.
38
+
Additionally, Springwolf generates an example based on the provided schema.
39
39
40
40
By using `swagger-parser`, all the `@Schema` and other swagger annotations are supported as well as `@JsonProperty` through the use of the objectmapper.
Copy file name to clipboardExpand all lines: docs/configuration/documenting-consumers.md
+9-95Lines changed: 9 additions & 95 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,32 +11,31 @@ For these use-cases, Springwolf provides additional ways to explicitly add them
11
11
12
12
To document consumers, either:
13
13
- add the `@AsyncListener` annotation or
14
-
- (deprecated) declare the `ConsumerData` object as part of the `AsyncApiDocket` or
15
14
- rely on the auto-detection of `@JmsListener`, `@KafkaListener`, `@RabbitListener`, `@SqsListener`
16
15
17
-
You are free to use all options together. Per channel and operation, first `ConsumerData` is used, then `@AsyncListener`and last the auto-detected annotations.
16
+
You are free to use both options together. Channel and operation, documented via `@AsyncListener`have a higher precedence than auto-detected annotations.
18
17
19
-
## Option 1: `@AsyncListener`
18
+
## `@AsyncListener`
20
19
21
20
The `@AsyncListener` annotation is added to the method of the listeners and extracts the payload from its arguments.
22
21
Additional fields can be documented.
23
22
24
-
The protocol operation binding is configured via `@AmqpAsyncOperationBinding`, `@KafkaAsyncOperationBinding` or `@AsyncGenericOperationBinding`, which has to be on the same method.
23
+
On the same method, the protocol binding is defined. More details can be found in the [bindings](documenting-bindings.md) section.
25
24
26
25
Below is an example to demonstrate the annotation:
27
26
```java
28
27
@KafkaListener
29
28
@AsyncListener(operation=@AsyncOperation(
30
29
channelName="example-consumer-topic",
31
-
description="Optional. Customer uploaded an example payload",
32
-
servers= {"kafka"},
33
-
headers=@AsyncOperation.Headers(
30
+
description="Customer uploaded an example payload",// Optional
Multiple consumers can be configured by calling the `consumer()` method multiple times.
108
-
109
-
:::tip
110
-
Use specific ConsumerData types `AmqpConsumerData` & `KafkaConsumerData` for protocol specific attributes
111
-
:::
112
-
113
-
### Channel Name
114
-
115
-
The channel name (or topic name in case of Kafka) - this is the name that will be used to subscribe to messages to by the UI.
116
-
117
-
### Description
118
-
119
-
Optional. The description allows for human-friendly text to verbosely explain the _message_, like specific domain, what the topic is used for and which data it contains.
120
-
121
-
### Binding
122
-
123
-
This property is used to discriminate the producer's protocol and provide protocol-specific properties (see [documenting bindings](documenting-bindings.md)).
124
-
125
-
### Payload Type
126
-
127
-
The class object of the payload that will be consumed from this channel.
128
-
129
-
### Header
130
-
131
-
Optional. The headers describing the metadata of the payload.
132
-
By default, `AsyncHeaders.NOT_DOCUMENTED` is used to indicate that no explicit header documentation exists.
133
-
Use `AsyncHeaders` to add your custom headers, use `AsyncHeaders.NOT_USED` if you don't use headers and `AsyncHeadersForCloudEventsBuilder` if your events follow the CloudEvent specification.
134
-
135
-
136
-
### `AmqpConsumerData`
137
-
138
-
The above Kafka `ConsumerData` equivalent in `AmqpConsumerData`:
@@ -74,7 +74,7 @@ The default Jackson `ModelResolver` supports schema definitions via `@Schema` to
74
74
75
75
The `@Schema` annotation allows to set many properties like `description`, `example`, `requiredMode`, `minimum` to document payloads.
76
76
77
-
All properties are part of the produced AsyncApi file. However, not all are displayed in `springwolf-ui` (see [#378](https://github.com/springwolf/springwolf-core/issues/378))
77
+
All properties are part of the produced AsyncAPI file. However, not all are displayed in `springwolf-ui` (see [#378](https://github.com/springwolf/springwolf-core/issues/378))
78
78
79
79
#### Usage
80
80
@@ -112,11 +112,11 @@ public class ExamplePayloadDto {
0 commit comments