spring-projects / spring-projects/spring-modulith

Support Custom Event Name via Annotation for Stored Events

Open
#1,218 1 comment 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Jun 13, 2025.

in: event publication registry type: enhancement
Dominant language
Java
Stars
1.2k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

I’m currently using Spring Modulith’s event publication mechanism, and I noticed that when events are stored in the database (e.g., using EventPublicationRegistry with a persistent EventPublicationRepository), the system stores basic metadata such as the event type and timestamp.

It would be useful for us to store a custom event name (a human-readable identifier) in addition to the event’s class name. This would help in logging, querying, or categorizing events more easily—especially when the same event class might be reused in different contexts.

I’d like to propose an enhancement where we could annotate the event class with a custom name, for example:

@EventName("user.registered")
public class UserRegisteredEvent {

}

The framework could then optionally persist this value along with the event metadata.

Benefits:

Makes stored event data more readable and meaningful

Helps categorize and filter events

Can aid integration with observability tools or analytics dashboards

Would this be a reasonable addition? If so, I’d be happy to help contribute or collaborate on a PR.

Thanks for the great work on Spring Modulith!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.