Skip to content

Commit 04187a1

Browse files
committed
GH-243 - Add section on how to customize the Clock instance to be used to determine event publication dates.
1 parent c23c26b commit 04187a1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/docs/asciidoc/40-events.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,23 @@ Each log entry contains the original event in serialized form.
139139
The `EventSerializer` abstraction contained in `spring-modulith-events-core` allows plugging different strategies for how to turn the event instances into a format suitable for the datastore.
140140
Spring Modulith provides a Jackson-based JSON implementation through the `spring-modulith-events-jackson` artifact, which registers a `JacksonEventSerializer` consuming an `ObjectMapper` through standard Spring Boot auto-configuration by default.
141141

142+
[[events.customize-publication-date]]
143+
== Customizing the Event Publication Date
144+
By default, the Event Publication Registry will use the date returned by the `Clock.systemUTC()` as event publication date.
145+
If you want to customize this, register a bean of type clock with the application context:
146+
147+
[source, java]
148+
----
149+
@Configuration
150+
class MyConfiguration {
151+
152+
@Bean
153+
Clock myCustomClock() {
154+
return … // Your custom Clock instance created here.
155+
}
156+
}
157+
----
158+
142159
[[events.starters]]
143160
== Spring Boot Event Registry Starters
144161

0 commit comments

Comments
 (0)