Skip to main content

Architecture

The jEAP Error Handling Service (EHS) is a self-contained system that handles failed Kafka messages and Spring Modulith event publications. Business services never retry failed Kafka messages themselves: the jEAP messaging error handler wraps the failed message into a MessageProcessingFailedEvent and publishes it to an error topic. The EHS consumes that topic, persists the failure, retries temporary errors, escalates permanent errors to manual tasks, and offers a UI to inspect, resend and close errors. Services using the Modulith error handling starter report exhausted publications to a separate Modulith publication failure topic and receive retry or discard commands from the EHS.

Goals and constraints​

  • No message is ever lost. Every message that cannot be processed ends up either persisted in the EHS or, if even the EHS cannot process it, on a dedicated dead letter topic.
  • One EHS instance per business system. The EHS is published as a library; every system creates its own deployable instance (see Getting Started).
  • Retries are the responsibility of the EHS, not of the consuming services. Consumers classify failures as temporary or permanent; the EHS schedules resends for temporary failures.

Context​

Building blocks​

ModuleDescription
jeap-error-handling-serviceSpring Boot backend with all domain and infrastructure logic, published as a library. The built Angular UI is served from its classpath.
jeap-error-handling-uiAngular frontend. Built with npm/ng build during the Maven build and packaged as static resources.
jeap-error-handling-service-instanceThin pom-packaging parent used by the per-system instance repositories.

Inside jeap-error-handling-service the main components are:

Error state model​

The central entity is the Error with its ErrorState, which drives the entire lifecycle. Temporary failures are retried automatically; permanent failures create a manual task and wait for an operator.

The intermediate states SEND_TO_MANUALTASK, RESOLVE_ON_MANUALTASK and DELETE_ON_MANUALTASK allow pending task-management actions to be completed later if Agir is unavailable. See Message Flows for retry escalation and the transaction boundaries of Kafka and Modulith retry/delete actions.

Data model​

The causing message is stored exactly as it was read from Kafka (key and payload as byte arrays), so it can be republished unchanged, even if it could not be deserialized in the first place.

Failure metadata and shared causing messages​

A failure record carries two kinds of metadata: the error event's identity, timestamp, type and publisher, and the causing message's identity, type, publisher and Kafka location. The error data contains the code, message, description, stack trace and temporality (TEMPORARY, PERMANENT or UNKNOWN). This distinction matters when the EHS itself reports an error: the reporting service and the service that originally published the business message need not be the same.

For Kafka-origin errors, the EHS reuses an existing CausingEvent with the same causing-event ID rather than storing that message again for each failure. A scheduled resend records its planned time, actual resend time and cancellation flag. The state model and message flows describe how these records change during retries and manual actions.

Deployment view​

The EHS runs as a standard jEAP Spring Boot microservice. Production uses PostgreSQL with Flyway migrations; integration tests run against H2. See Operations for scheduled jobs and their coordination across instances.