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: src/docs/antora/modules/ROOT/pages/events.adoc
+13-13Lines changed: 13 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,7 @@ class OrderManagement(val events: ApplicationEventPublisher, val dependency: Ord
89
89
----
90
90
======
91
91
92
-
Note, how, instead of depending on the other application module's Spring bean, we use Spring's `ApplicationEventPublisher` to publish a domain event, once we have completed the state transitions on the primary aggregate.
92
+
Note how, instead of depending on the other application module's Spring bean, we use Spring's `ApplicationEventPublisher` to publish a domain event once we have completed the state transitions on the primary aggregate.
93
93
For a more aggregate-driven approach to event publication, see https://docs.spring.io/spring-data/data-commons/docs/current/reference/html/#core.domain-events[Spring Data's application event publication mechanism] for details.
94
94
As event publication happens synchronously by default, the transactional semantics of the overall arrangement stay the same as in the example above.
95
95
Both for the good, as we get to a very simple consistency model (either both the status change of the order _and_ the inventory update succeed or none of them does), but also for the bad as more triggered related functionality will widen the transaction boundary and potentially cause the entire transaction to fail, even if the functionality that is causing the error is not crucial.
@@ -164,7 +164,7 @@ class InventoryManagement {
164
164
----
165
165
======
166
166
167
-
To ease the declaration of what is supposed to describe the default way of integrating modules via events, Spring Modulith provides `@ApplicationModuleListener` to shortcut the declaration
167
+
To ease the declaration of what is supposed to describe the default way of integrating modules via events, Spring Modulith provides `@ApplicationModuleListener` as a shortcut.
168
168
169
169
.An application module listener
170
170
[tabs]
@@ -241,8 +241,8 @@ Using the transactional event publication log requires a combination of artifact
241
241
Event publications may need to be managed in a variety of ways during the runtime of an application.
242
242
Incomplete publications might have to be re-submitted to the corresponding listeners after a given amount of time.
243
243
Completed publications on the other hand, will likely have to be purged from the database or moved into an archive store.
244
-
As the needs for that kind of housekeeping strongly vary from application to application, Spring Modulith offers API to deal with both kinds of publications.
245
-
That API is available through the `spring-modulith-events-api` artifact, that you can add to your application:
244
+
As the needs for that kind of housekeeping strongly vary from application to application, Spring Modulith offers an API to deal with both kinds of publications.
245
+
That API is available through the `spring-modulith-events-api` artifact that you can add to your application:
246
246
247
247
.Using Spring Modulith Events API artifact
248
248
[tabs]
@@ -268,10 +268,10 @@ dependencies {
268
268
----
269
269
======
270
270
271
-
This artifact contains two primary abstractions, that are available to application code as Spring Beans:
271
+
This artifact contains two primary abstractions that are available to application code as Spring Beans:
272
272
273
-
* `CompletedEventPublications` -- This interface allows accessing all completed event publications, and provides API to immediately purge all of them from the database or the completed publications older that a given duration (for example, 1 minute).
274
-
* `IncompleteEventPublications`-- This interface allows accessing all incomplete event publications to resubmit either the ones matching a given predicate or older than a given `Duration` relative to the original publishing date.
273
+
* `CompletedEventPublications` -- This interface allows accessing all completed event publications, and provides an API to immediately purge all of them from the database or the completed publications older that a given duration (for example, 1 minute).
274
+
* `IncompleteEventPublications`-- This interface allows accessing all incomplete event publications to resubmit either the ones matching a given predicate or older than a given `Duration` relative to the original publishing date.
275
275
276
276
[[publication-registry.publication-repositories]]
277
277
=== Event Publication Repositories
@@ -330,7 +330,7 @@ To find out how to use other ways of selecting events for externalization, or cu
330
330
|Kafka
331
331
|`spring-modulith-events-kafka`
332
332
|Uses Spring Kafka for the interaction with the broker.
333
-
The logical routing key will be used as
333
+
The logical routing key will be used as Kafka's topic and message key.
334
334
335
335
|AMQP
336
336
|`spring-modulith-events-amqp`
@@ -365,7 +365,7 @@ The event externalization performs three steps on each application event publish
365
365
By default, only event types located within a Spring Boot auto-configuration package and annotated with one of the supported `@Externalized` annotations are selected for externalization.
366
366
2. _Mapping the event (optional)_ -- By default, the event is serialized to JSON using the Jackson `ObjectMapper` present in the application and published as is.
367
367
The mapping step allows developers to either customize the representation or even completely replace the original event with a representation suitable for external parties.
368
-
Note, that the mapping step precedes the actual serialization of the to be published object.
368
+
Note that the mapping step precedes the actual serialization of the to be published object.
369
369
3. _Determining a routing target_ -- Message broker clients need a logical target to publish the message to.
370
370
The target usually identifies physical infrastructure (a topic, exchange, or queue depending on the broker) and is often statically derived from the event type.
371
371
Unless defined in the `@Externalized` annotation specifically, Spring Modulith uses the application-local type name as target.
@@ -408,7 +408,7 @@ class CustomerCreated {
408
408
----
409
409
======
410
410
411
-
The `CustomerCreated` event exposes the lastname of the customer via an accessor method.
411
+
The `CustomerCreated` event exposes the last name of the customer via an accessor method.
412
412
That method is then used via the ``#this.getLastname()`` expression in key expression following the `::` delimiter of the target declaration.
413
413
414
414
If the key calculation becomes more involved, it is advisable to rather delegate that into a Spring bean that takes the event as argument:
@@ -483,7 +483,7 @@ This step fundamentally disables the application base package filter as we only
483
483
Convenience methods to easily select events by type, by packages, packages and annotation exist.
484
484
Also, a shortcut to define selection and routing in one step.
485
485
<3> We define a mapping step for `SomeEvent` instances.
486
-
Note, that the routing will still be determined by the original event instance, unless you additionally call `….routeMapped()` on the router.
486
+
Note that the routing will still be determined by the original event instance, unless you additionally call `….routeMapped()` on the router.
487
487
<4> We finally determine a routing key by defining a method handle to extract a value of the event instance.
488
488
Alternatively, a full `RoutingKey` can be produced for individual events by using the general `route(…)` method on the `Router` instance returned from the previous call.
489
489
@@ -536,7 +536,7 @@ class OrderIntegrationTests {
536
536
----
537
537
======
538
538
539
-
Note, how `PublishedEvents` exposes API to select events matching a certain criteria.
539
+
Note how `PublishedEvents` exposes an API to select events matching a certain criteria.
540
540
The verification is concluded by an AssertJ assertion that verifies the number of elements expected.
541
541
If you are using AssertJ for those assertions anyway, you can also use `AssertablePublishedEvents` as test method parameter type and use the fluent assertion APIs provided through that.
542
542
@@ -579,4 +579,4 @@ class OrderIntegrationTests {
579
579
----
580
580
======
581
581
582
-
Note, how the type returned by the `assertThat(…)` expression allows to define constraints on the published events directly.
582
+
Note how the type returned by the `assertThat(…)` expression allows to define constraints on the published events directly.
Copy file name to clipboardExpand all lines: src/docs/antora/modules/ROOT/pages/fundamentals.adoc
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,7 @@ In such an arrangement, the `order` package is considered an API package.
69
69
Code from other application modules is allowed to refer to types within that.
70
70
`order.internal`, just as any other sub-package of the application module base package, is considered an _internal_ one.
71
71
Code within those must not be referred to from other modules.
72
-
Note, how `SomethingOrderInternal` is a public type, likely because `OrderManagement` depends on it.
72
+
Note how `SomethingOrderInternal` is a public type, likely because `OrderManagement` depends on it.
73
73
This unfortunately means that it can also be referred to from other packages such as the `inventory` one.
74
74
In this case, the Java compiler is not of much use to prevent these illegal references.
75
75
@@ -287,7 +287,7 @@ For modules without explicitly described dependencies, both the application modu
287
287
=== Customizing Module Detection
288
288
289
289
If the default application module model does not work for your application, the detection of the modules can be customized by providing an implementation of `ApplicationModuleDetectionStrategy`.
290
-
That interface exposes a single method `Stream<JavaPackage> getModuleBasePackages(JavaPackage)` and will be called with the package, the Spring Boot application class resides in.
290
+
That interface exposes a single method `Stream<JavaPackage> getModuleBasePackages(JavaPackage)` and will be called with the package the Spring Boot application class resides in.
291
291
You can then inspect the packages residing within that and select the ones to be considered application module base packages based on a naming convention or the like.
292
292
293
293
Assume you declare a custom `ApplicationModuleDetectionStrategy` implementation like this:
Copy file name to clipboardExpand all lines: src/docs/antora/modules/ROOT/pages/runtime.adoc
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -103,4 +103,4 @@ class MyInitializer : ApplicationModuleInitializer {
103
103
}
104
104
----
105
105
======
106
-
Note, that the `ApplicationModuleInitializer` beans will only be invoked if the `spring-modulith-runtime` JAR is on the classpath (see xref:runtime.adoc#setup[Setting up Runtime Support for Application Modules]) as that pulls in the dependencies that are needed to topologically sort the initializers according to the application module structure.
106
+
Note that the `ApplicationModuleInitializer` beans will only be invoked if the `spring-modulith-runtime` JAR is on the classpath (see xref:runtime.adoc#setup[Setting up Runtime Support for Application Modules]) as that pulls in the dependencies that are needed to topologically sort the initializers according to the application module structure.
Copy file name to clipboardExpand all lines: src/docs/antora/modules/ROOT/pages/testing.adoc
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
= Integration Testing Application Modules
3
3
4
4
Spring Modulith allows to run integration tests bootstrapping individual application modules in isolation or combination with others.
5
-
To achieve this, place JUnit test class in an application module package or any sub-package of that and annotate it with `@ApplicationModuleTest`:
5
+
To achieve this, place a JUnit test class in an application module package or any sub-package of that and annotate it with `@ApplicationModuleTest`:
6
6
7
7
.A application module integration test class
8
8
[tabs]
@@ -156,7 +156,7 @@ The test definition itself usually follows the following skeleton:
156
156
3. The definition of some expected outcome, such as another application event being fired that matches some criteria or some state change of the module that can be detected by invoking exposed components.
157
157
4. Optional, additional verifications made on the received event or observed, changed state.
158
158
159
-
`Scenario` exposes API to define these steps and guide you through the definition.
159
+
`Scenario` exposes an API to define these steps and guide you through the definition.
160
160
161
161
.Defining a stimulus as starting point of the `Scenario`
* _No cycles on the application module level_ -- the dependencies between modules have to form directed, acyclic graph.
25
-
* _Efferent module access via API packages only_ -- All references to types that reside in application module internal packages are rejected.
24
+
* _No cycles on the application module level_ -- the dependencies between modules have to form a directed acyclic graph.
25
+
* _Efferent module access via API packages only_ -- all references to types that reside in application module internal packages are rejected.
26
26
See xref:fundamentals.adoc#modules.advanced[Advanced Application Modules] for details.
27
-
* _Explicitly allowed application module dependencies only_ (optional) -- An application module can optionally define allowed dependencies via `@ApplicationModule(allowedDependencies = …)`.
27
+
* _Explicitly allowed application module dependencies only_ (optional) -- an application module can optionally define allowed dependencies via `@ApplicationModule(allowedDependencies = …)`.
28
28
If those are configured, dependencies to other application modules are rejected.
29
29
See xref:fundamentals.adoc#modules.explicit-dependencies[Explicit Application Module Dependencies] and xref:fundamentals.adoc#modules.named-interfaces[Named Interfaces] for details.
0 commit comments