Skip to main content

Configuration

Everything the example is wired with, and why. See Architecture for what these settings add up to.

Ports​

The Kafka broker and the schema registry use the ports the jEAP examples conventionally use, so only one jme example can run at a time. The services themselves use a range of their own.

PortWhat
8090jme-spring-modulith-scs, context path /jme-spring-modulith-scs
8091jme-spring-modulith-auth-scs, context path /jme-spring-modulith-auth-scs
8092jme-spring-modulith-error-scs, context path /error-handling
9092Kafka broker (SASL_PLAINTEXT, SCRAM-SHA-512, user/user-secret)
7781Schema registry
5540PostgreSQL of the modulith service (modulith/secret)
5541PostgreSQL of the error handling service (errorhandling/secret)

The Error Handling Service dependency includes its UI under /error-handling. The OAuth mock allows its login and post-logout redirects, including the exact local logout target http://localhost:8092/error-handling/.

Topics​

TopicMessageProduced byConsumed by
jme-order-created-modulithJmeOrderCreatedEventthe demo endpoint (stands in for an external system)messaging module
jme-messageprocessing-failedMessageProcessingFailedEventthe jEAP messaging error handlerjme-spring-modulith-error-scs
jme-modulith-publication-processing-failedModulithPublicationProcessingFailedEventthe Modulith error handling starterjme-spring-modulith-error-scs
jme-retry-modulith-publicationRetryModulithPublicationCommandjme-spring-modulith-error-scsthe Modulith error handling starter
jme-discard-modulith-publicationDiscardModulithPublicationCommandjme-spring-modulith-error-scsthe Modulith error handling starter
jme-messageprocessing-deadletterMessageProcessingFailedEventthe error handling servicenobody (monitored)

JmeOrderCreatedEvent comes from the jme message type registry as a released artifact (ch.admin.bit.jeap.jme.messagetype.jme:jme-order-created-event). This example uses the dedicated topic jme-order-created-modulith rather than the message type's default topic, so its traffic is isolated from other examples. MessagingTopics.ORDER_CREATED is shared by the publisher, listener and producer/consumer contract declarations. Platform bindings must grant the application read/write access and the shared EHS write access for Kafka-message retries.

Spring Modulith​

jme-spring-modulith-scs/src/main/resources/application.yml:

PropertyValueWhy
spring.modulith.events.jdbc.schema-initialization.enabledfalseThe event_publication table is owned by Flyway (V1__initial_schema.sql), like every other table
spring.modulith.events.completion-modeupdateKeep publications after completion instead of deleting or archiving them, so failures stay inspectable
spring.modulith.events.republish-outstanding-events-on-restartfalsePrevent startup from replaying incomplete publications outside the starter's retry budget
spring.modulith.events.staleness.check-intervall30sHow often to look for publications that got stuck
spring.modulith.events.staleness.published2mMark an old never-started publication failed so the starter applies its retry policy
spring.modulith.events.staleness.processing2mAfter this, a publication stuck in PROCESSING is marked FAILED and becomes retryable again
spring.modulith.events.staleness.resubmitted2mThe same for a publication stuck in RESUBMITTED

All incomplete states recover by first becoming FAILED. The starter's generation-aware database claim then remains the only path that increments attempts and enforces max-completion-attempts.

The staleness monitor and the starter's retry and reconciliation loops are scheduled tasks, so Application is annotated @EnableScheduling.

Failed internal asynchronous events​

The jeap-spring-modulith-error-handling-starter owns the persistent retry and escalation policy for failed JDBC v2 publications. Its configuration guide documents all properties and their defaults. This example only overrides the following values:

PropertyValue
retry-interval5s
retry-min-age2s
max-completion-attempts3
reconciliation-interval5s
reconciliation-min-age2s
failure-event-topicjme-modulith-publication-processing-failed
retry-command-topicjme-retry-modulith-publication
discard-command-topicjme-discard-modulith-publication

The values are deliberately impatient so the behaviour is observable while trying out the example. A real service would use longer intervals. Module tests set both initial delays to one hour so scheduled sweeps cannot race tests that invoke the policy directly. completion_attempts keeps the retry budget across restarts. Once the budget is exhausted, the starter publishes a failure event through the transactional outbox and records (publication_id, completion_attempts) in modulith_publication_failure. The Error Handling Service stores the event with origin MODULITH_PUBLICATION and publishes a UUID-exact retry or discard command on the consumed Kafka cluster when an operator acts on it.

Error handling service​

jme-spring-modulith-error-scs:

PropertyValueMeaning
jeap.errorhandling.topicjme-messageprocessing-failedWhere it looks for failures
jeap.errorhandling.modulithPublicationProcessingFailedTopicjme-modulith-publication-processing-failedWhere it looks for failed Modulith publications
jeap.errorhandling.deadLetterTopicNamejme-messageprocessing-deadletterWhere its own unprocessable messages go
jeap.errorhandling.resend.default-resending-strategy.max-retries3Resends of a temporary failure before it becomes permanent
jeap.errorhandling.resend.default-resending-strategy.delay10sBetween resends
jeap.errorhandling.task-management.service.enabledfalseNo Agir integration in this example
jeap.errorhandling.frontend.*setConfiguration served to the bundled UI, including the local logout redirect

On the consumer side the entire wiring to the error handling service is a single property in jme-spring-modulith-scs:

jeap:
messaging:
kafka:
errorTopicName: jme-messageprocessing-failed

Roles and clients​

jeap.security.oauth2.resourceserver.system-name: jme activates the semantic role model, in which a role reads system_%tenant_@resource_#operation. Each domain-facing module owns one resource. The messaging adapter reuses order/write for its demo producer because that endpoint initiates order registration.

Endpoint@PreAuthorizeRole
GET /api/orders, GET /api/orders/{orderId}hasRole('order', 'read')jme_@order_#read
POST /api/ordershasRole('order', 'write')jme_@order_#write
POST /api/demo/ordershasRole('order', 'write')jme_@order_#write
GET /api/inventoryhasRole('inventory', 'read')jme_@inventory_#read
GET /api/notificationshasRole('notification', 'read')jme_@notification_#read
GET /api/shipments, /api/shipments/attempts, /api/shipments/publications/{id}hasRole('shipping', 'read')jme_@shipping_#read

The OAuth mock server defines one browser client and four system clients. The system clients use the client-credentials grant with the secret secret:

ClientRolesAudienceUsed by
error-handling-uiEHS view, retry, delete and error-group rolesjme-spring-modulith-error-scsEHS UI authorization-code flow
jme-spring-modulith-clientroles for order, inventory, notification and shipping resourcesjme-spring-modulith-scsthe local walkthrough, the tests
jme-spring-modulith-client-without-rolesjme_@unrelated_#readjme-spring-modulith-scsdemonstrating the 403 path
jme-spring-modulith-error-clientjme_@error_#view/#retry/#delete, jme_@errorgroup_#view/#editjme-spring-modulith-error-scsquerying the error handling service
jme-spring-modulith-error-servicethe same error rolesjme-spring-modulith-error-scsthe error handling service's own outgoing calls

The audience matters: each service validates that its own application name is in the aud claim, so a token for the modulith service is rejected by the error handling service and vice versa. That is why querying the errors needs a second token.

Actuator​

jeap-spring-boot-monitoring-starter disables actuator endpoints by default, enables a known set, and denies anything else. The Spring Modulith endpoint is not in that set, so it needs two settings:

jeap:
monitor:
actuator:
additional-permitted-endpoints:
- org.springframework.modulith.actuator.ApplicationModulesEndpoint
# application-local.yml only
jeap:
monitor:
actuator:
enable-admin-endpoints: true

additional-permitted-endpoints has no effect unless enable-admin-endpoints is true, and jEAP requires that to stay false on acceptance and production — hence the split between the two files. /actuator/modulith is then reachable with the actuator basic-auth user.

Profiles​

ProfileWhere it comes fromWhat it changes
localpassed on the command linePorts, credentials, the authorization server issuer, Kafka on localhost
ciactivated when CI is set, next to localKafka and the databases addressed by container name instead of localhost
testthe module testsKafka listeners off, a dummy issuer, no schema registry

The integration tests resolve local or local,ci through BootServiceIntegrationTestBase.TestProfileResolver, so the CI profile is only ever an overlay.

Testcontainers​

jme-spring-modulith-scs/src/test/resources/testcontainers.properties sets hub.image.name.prefix, so the PostgreSQL image and the Ryuk sidecar Testcontainers starts itself are both pulled from the configured registry. Image names in the test code stay plain.