Skip to content

Commit

Permalink
GH-243 - Add section on how to customize the Clock instance to be use…
Browse files Browse the repository at this point in the history
…d to determine event publication dates.
  • Loading branch information
odrotbohm committed Aug 1, 2023
1 parent c23c26b commit 04187a1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/docs/asciidoc/40-events.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,23 @@ Each log entry contains the original event in serialized form.
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.
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.

[[events.customize-publication-date]]
== Customizing the Event Publication Date
By default, the Event Publication Registry will use the date returned by the `Clock.systemUTC()` as event publication date.
If you want to customize this, register a bean of type clock with the application context:

[source, java]
----
@Configuration
class MyConfiguration {
@Bean
Clock myCustomClock() {
return … // Your custom Clock instance created here.
}
}
----

[[events.starters]]
== Spring Boot Event Registry Starters

Expand Down

0 comments on commit 04187a1

Please sign in to comment.