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
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ sidebar_position: 70
7
7
The following paragraphs describe how Springwolf works internally.
8
8
9
9
## Big Picture
10
+
10
11
When the Spring Boot application is started, Springwolf uses its scanners to find defined consumers and producers within the application.
11
12
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/v3.0.0).
12
13
@@ -17,19 +18,22 @@ When publishing is enabled, the user can publish a message through the UI to ano
17
18
From there, Springwolf forwards the message to the protocol specific producer.
18
19
19
20
## Plugins
21
+
20
22
`springwolf-core` provides the base functionality to orchestrate the scanning and building of the AsyncAPI document.
21
23
The different protocol (AMQP, Cloud-Stream, JMS, Kafka, SNS, SQS) are supported through plugins.
22
24
These plugins are found through the Spring dependency injection functionality.
23
25
When building own scanner plugins, your plugin will need to implement the `ChannelsScanner` interface.
24
26
25
27
## Scanners
28
+
26
29
`springwolf-core` runs all scanners and merges the found results together into one AsyncAPI document.
27
30
When the same channel/topic is found multiple times, it's merged as well.
28
31
29
32
The result is a [`ChannelItem`](https://www.asyncapi.com/docs/reference/specification/v3.0.0#channelObject).
30
33
The `ChannelObject` contains the `Message` for the receive and/or send operation.
31
34
32
35
## Building an example payload
36
+
33
37
When the scanners scan and build the result, they also extract the payload type.
34
38
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
39
@@ -40,9 +44,11 @@ Additionally, Springwolf generates an example based on the provided schema.
40
44
By using `swagger-parser`, all the `@Schema` and other swagger annotations are supported as well as `@JsonProperty` through the use of the ObjectMapper.
41
45
42
46
### ModelConverters
47
+
43
48
ModelConverters provide a way to improve documentation for classes, which can't be modified, for example because they're part of an external library.
44
49
They follow the same plugin model.
45
50
46
51
## Putting it all together
52
+
47
53
The `AsyncApiService` collects all the channels, schemas and general info and builds the AsyncApi document.
48
54
The controller access this services to serve the document to the UI.
@@ -130,27 +137,34 @@ The Channel Bindings Object is used to describe the Google Cloud Pub/Sub Topic d
130
137
lastRevisionId="lastRevisionId",
131
138
name="projects/{project}/schemas/{schema}"))
132
139
```
133
-
`MessageRetentionDuration`: Indicates the minimum duration to retain a message after it's published to the topic
140
+
141
+
`MessageRetentionDuration`: Indicates the minimum duration to retain a message after it's published to the topic
134
142
135
143
`Message Storage Policy`: The Message Storage Policy Object is used to describe the Google Cloud Pub/Sub MessageStoragePolicy.
136
-
- A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage
144
+
145
+
- A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage
137
146
138
147
`Schema Settings`:The Schema Settings Object is used to describe the Google Cloud Pub/Sub SchemaSettings.
148
+
139
149
- encoding: The encoding of the message
140
150
- firstRevisionId: The minimum (inclusive) revision allowed for validating messages
141
151
- lastRevisionId: The maximum (inclusive) revision allowed for validating messages
142
152
- name: The name of the schema that messages published should be validated against (The format is `projects/{project}/schemas/{schema}`.)
153
+
143
154
#### Message Binding Object
155
+
144
156
The Message Binding Object is used to describe the Google Cloud Pub/Sub PubsubMessage details, alongside with pertinent parts of the Google Cloud Pub/Sub Schema Object.
`OrderingKey`: If non-empty, identifies related messages for which publish order should be respected
151
165
152
166
`Schema Definition`: The Schema Definition Object is used to describe the Google Cloud Pub/Sub Schema Object with AsyncAPI. While some of this information could be, or is, described using native AsyncAPI, for consistency it makes sense to provide this information here at all times, especially for cases where AsyncAPI doesn't natively support describing payloads using a supported Google Cloud Pub/Sub schema format like Protobuf
When the `springwolf-ui` dependency is added, the UI should be visible at [http://localhost:8080/springwolf/asyncapi-ui.html](http://localhost:8080/springwolf/asyncapi-ui.html).
37
37
38
38
If not, whether
39
-
1. you customized the spring `context-path` setting
39
+
40
+
1. you customized the spring `context-path` setting
40
41
2. static assets are being served at all. See the code below:
41
-
```java
42
+
43
+
```java
42
44
@Configuration
43
45
publicclassWebConfigimplementsWebMvcConfigurer {
44
46
@Override
@@ -83,10 +85,13 @@ Due to java type erasure some generic type information is lost during runtime.
83
85
Defining your own type can resolve this.
84
86
85
87
Change
88
+
86
89
```java
87
90
publicvoid sendMessage(List<String> msg) {}
88
91
```
92
+
89
93
to
94
+
90
95
```java
91
96
classListWrapperextendsArrayList<String> {}
92
97
@@ -95,18 +100,19 @@ public void sendMessage(ListWrapper<String> msg) {}
95
100
96
101
### How to migrate from Springwolf0.18.0 to 1.0.0
97
102
98
-
See https://github.com/springwolf/springwolf-core/releases/tag/v1.0.0.
Copy file name to clipboardExpand all lines: docs/introduction/introduction.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ Integrate Springwolf in minutes using the [Quickstart](../quickstart.mdx).
9
9
:::
10
10
11
11
## What's Springwolf
12
+
12
13
API Documentation is an important part of every project and product, but can be painful to maintain manually.
13
14
Spring Boot projects have great solutions for auto-generated documentation for REST APIs to overcome this pain (such as Springfox, or springdoc-openapi).
14
15
@@ -20,8 +21,8 @@ Springwolf is compliant to [AsyncAPI](https://www.asyncapi.com), which brings th
20
21
21
22
View the [live demo](https://demo.springwolf.dev) of Springwolf in action.
0 commit comments