spring-projects / spring-projects/spring-modulith

Enhancement: Provide feedback or notification for event publishing failures

Open
#1,361 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.2k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

Problem / Motivation

Currently, when publishing domain events in Spring Modulith, the user or calling component cannot know whether the event processing succeeded or failed.
This limits the ability to provide immediate feedback to the user or handle failures programmatically.

Proposed Enhancement

I propose one or more of the following enhancements:

Failure Callback Interface
Provide an interface (e.g., EventFailureHandler) that developers can implement.
When an event fails to execute, the event source information is passed to this handler, allowing developers to implement custom logic (e.g., retry, logging, sending notifications).

Built-in Notification / Messaging Module
Spring Modulith could provide a default mechanism to notify clients/frontends when an event fails.
For example, a simple message bus or WebSocket/REST callback to inform the frontend of the failure.

Success/Failure Acknowledgment for Event Publishing
Optionally, event publishing could return a success/failure status, or a CompletableFuture indicating the outcome of event processing.

Benefits

Improves UX by allowing immediate feedback on event outcomes.

Provides hooks for handling domain event failures in a structured way.

Enables developers to integrate notifications or compensating actions seamlessly.

public class MyEventFailureHandler implements EventFailureHandler {
    @Override
    public void handleFailure(DomainEvent event, Throwable cause) {
        // Send notification to frontend
        // Log error
        // Trigger compensating transaction
    }
}

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.

Research direction

Start by reading Spring Modulith's event publishing APIs and failure-handling entry points; the issue does not name files or tests. Compare the proposed EventFailureHandler, notification mechanism, and CompletableFuture acknowledgment options, then define one concrete outcome and tests for success and failure behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.