ADR 0002: Use Spring Events for Internal Communication

Status

Accepted

Context

Orders should trigger payment behavior, but the orders module should not depend on payment implementation details. Introducing Kafka or RabbitMQ would make the project look distributed without a real need.

Decision

Orders publish OrderPlacedEvent through the shared EventPublisher port. ecommerce-app adapts that port to Spring’s in-process event publisher. Payment listens with a transactional event listener after commit.

Consequences

Benefits:

Trade-offs: