spring-projects / spring-projects/spring-modulith

Automatic Retry Scheduler for FAILED Events (Complement to Staleness Monitor)

Open
#1,439 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: event publication registry meta: waiting for feedback type: improvement
Dominant language
Java
Stars
1.2k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

Feature Request: Automatic Retry Scheduler for FAILED Events

Requested: Add configurable automatic retry scheduler that leverages the new v2 schema infrastructure (completion_attempts, explicit states, multi-instance safety).

Context

Spring Modulith 2.0 M1 introduced:

  • Staleness monitor (detects stuck events, marks as FAILED) ✅
  • Completion attempts tracking ✅
  • Multi-instance safety ✅

Missing piece: Automatic retry of FAILED events

Current Behavior

  1. Event fails or gets stuck → Staleness monitor marks as FAILED ✅
  2. Event remains in FAILED state forever ❌
  3. Manual intervention required to retry ❌

Requested Feature

Add configurable retry scheduler:

spring:
  modulith:
    events:
      staleness:
        enabled: true
        processing-timeout: 5m
      
      # NEW: Automatic retry configuration
      retry:
        enabled: true
        fixed-delay: 60s
        max-attempts: 10              # ← Uses completion_attempts
        max-age: 7d                   # ← Age-based limit
        batch-size: 100
        states-to-retry:
          - FAILED                    # ← Retry events marked by staleness monitor
          - PUBLISHED                 # ← Retry immediate failures

How It Would Work

  1. External system fails → Event marked FAILED by staleness monitor
  2. Retry scheduler (every 60s):
    • Queries events in FAILED state
    • Filters by completion_attempts < 10
    • Filters by age < 7 days
    • Changes state to RESUBMITTED
    • Republishes events
  3. If successful → State changes to COMPLETED
  4. If fails again → completion_attempts++, back to FAILED
  5. After 10 attempts or 7 days → Marked as BLOCKED

Propoesed state diagram-

Image

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 with the existing staleness monitor, completion_attempts tracking, explicit event states, and multi-instance safety described in the issue; no source files or tests are named. Done means a configurable scheduler retries eligible FAILED or PUBLISHED events, enforces attempt and age limits, republishes them safely, and marks exhausted events BLOCKED.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.