Recent Posts
Archives

Posts Tagged ‘EventStorming’

PostHeaderIcon [VoxxedDaysAmsterdam2026] Taming Microservice Overload: The Journey to Modular Monoliths at the Port of Rotterdam

Lecturer
Mario Klaver is a solution architect at the Port of Rotterdam, responsible for digital systems supporting Harbour Master operations. With a background as a developer, he remains actively involved in programming and puzzle-solving.

Abstract
Mario Klaver recounts the evolution of the Port of Rotterdam’s mission-critical harbor management system from a monolithic application through an explosion of microservices to a more sustainable modular monolith architecture. Using Domain-Driven Design (DDD) techniques such as EventStorming and bounded contexts, combined with Spring Modulith, the team consolidated over 90 microservices into fewer, well-bounded services aligned with business domains. The presentation details the motivations, challenges, implementation approach, migration strategy, and lessons learned, offering practical insights for organizations facing similar architectural fatigue.

From Monolith to Microservices: The Growth of Complexity

In 2010, the Port of Rotterdam initiated a new 24/7 mission-critical system for the Harbour Master division using then-contemporary technologies like Java and Swing (with offline requirements precluding full HTML5 adoption). By 2015, a single backend had become unmaintainable spaghetti code with lengthy manual regression tests.

Following conventional wisdom, the team adopted microservices in 2016, starting with 10 services. By 2018 this grew to 50, and eventually exceeded 90. Every new feature or subject—vessel visits, inspections, dangerous goods, waste handling—spawned additional services, sometimes multiple per domain. Rather than reducing complexity, microservices distributed it, creating tight coupling, high cloud costs (exacerbated by multiple environments and ports), extensive update overhead, and paradoxically slower delivery despite supposed team autonomy.

Anonymized architecture diagrams revealed that services appeared logically separated by responsibility (vessel visits, conflict signaling, clearance) yet events and synchronous calls created a web of dependencies where boundaries were unclear or misplaced. The realization emerged: microservices had not fixed the architecture; they had merely distributed the mess.

Rediscovering Domain Boundaries with EventStorming and DDD

The turning point involved shifting focus from technical partitioning to domain alignment. EventStorming workshops proved instrumental—a collaborative, chaotic yet powerful technique using brown paper, stickies, and domain events to map complex business processes. Participants from business, development, architecture, UX, and operations contributed partial knowledge to build a shared understanding.

Pivotal events, parallel flows, and heuristics helped surface natural subdomains (e.g., Visit, Clearance) and bounded contexts within them. Digitized results clarified responsibilities that differed markedly from existing service implementations. Good boundaries were defined by low coupling (changes mostly contained within a module or service) and high cohesion (modules focused on a clear purpose).

The decision was made to move toward one (larger) service per subdomain, implemented as modular monoliths to prevent internal spaghetti while preserving clear interfaces.

Implementing Modular Monoliths with Spring Modulith

Spring Modulith aligns perfectly with DDD bounded contexts. After adding the dependency, packages directly under the application entry point become modules by convention. Public APIs (Spring beans or events) are exposed in designated packages or via @NamedInterface annotations, while other packages remain private and inaccessible across modules.

IntelliJ provides excellent visual support with green/red indicators for public/private elements. The @ApplicationModule annotation enforces allowed dependencies and prevents cycles. An open/closed mode facilitates gradual migration. Crucially, architecture tests (using @ApplicationModuleTest) verify module boundaries, API usage, and absence of cycles—failing builds if violated.

Inter-module communication prefers Spring’s event publishing and consumption mechanisms. Synchronous listeners use @TransactionalEventListener, while asynchronous ones leverage Modulith’s @ApplicationModuleListener, which persists events for reliability across restarts and decouples transactions. This design eases future extraction of modules into separate services if needed.

Module-specific tests spin up isolated Spring contexts, enabling verification of event flows (e.g., publishing a security clearance event and asserting a downstream vessel movement decision).

Migration Strategy and Architectural Trade-offs

A full green-field rebuild was deemed impractical given a roughly five-year horizon. Instead, the team adopted an incremental “heart surgery while the patient lives” approach: create walking skeletons for new modular services, migrate relevant legacy services as modules, reroute connections, and decommission old instances using feature flags to avoid duplicate processing. Databases initially remain shared before eventual per-module schema separation and a broader Oracle-to-PostgreSQL migration.

Takeaways include faster development and simpler debugging within a single service, reduced infrastructure, but larger deployables requiring broader regression testing, reduced independent scalability, and greater impact during outages.

Lessons Learned and Broader Implications

Key lessons encompass inclusive EventStorming participation to avoid blind spots, ongoing domain exploration and validation with real scenarios, and persistence with clean architectures (e.g., onion/hexagonal) despite mapping overhead—which AI may eventually alleviate. Boundaries matter more than the number of services. A modular monolith often serves as the ideal starting point or interim step before microservices, as correcting boundaries post-split is far costlier.

Mario concludes that microservices distribute complexity, whereas well-designed boundaries control it. The Port of Rotterdam’s journey illustrates a pragmatic path for organizations overwhelmed by service proliferation.

Code Sample: Spring Modulith Module Configuration

@ApplicationModule(
    allowedDependencies = {"securityClearance", "vesselVisit"},
    type = ApplicationModule.Type.OPEN  // during migration
)
public class PortClearanceApplication { ... }

Code Sample: Event Consumption

@TransactionalEventListener
public void onSecurityClearanceCompleted(SecurityClearanceCompletedEvent event) {
    // process within transaction
}

@ApplicationModuleListener
public void onAsyncEvent(AnotherEvent event) {
    // decoupled, persisted for reliability
}

These patterns enforce architectural integrity while leveraging familiar Spring mechanisms.

In reflecting on the Port of Rotterdam’s experience, Mario Klaver delivers a compelling case study in architectural modernization. By realigning services with domain realities through DDD and enforcing modularity with Spring Modulith, the organization has regained clarity, ownership, and sustainable evolution capacity without sacrificing the benefits of service-oriented thinking.

Links:

PostHeaderIcon [NDCMelbourne2025] Preventing Emu Wars with Domain-Driven Design – Lee Dunkley

In an engaging and humorous presentation at NDC Melbourne 2025, Lee Dunkley explores how Domain-Driven Design (DDD) can prevent software projects from spiraling into chaotic, unmaintainable codebases—likening such failures to Australia’s infamous Emu War. By drawing parallels between historical missteps and common software development pitfalls, Lee illustrates how DDD practices, such as event storming and ubiquitous language, can steer teams toward solving the right problems, thereby enhancing maintainability and extensibility.

The Emu War: A Cautionary Tale for Coders

Lee begins with a whimsical analogy, recounting Australia’s 1930s Emu War, where soldiers armed with machine guns failed to curb an overwhelming emu population devastating crops. The emus’ agility and sheer numbers outmatched the military’s efforts, leading to a humbling defeat. Lee cleverly translates this to software development, where throwing endless code at a problem—akin to deploying infinite soldiers—often results in a complex, bug-ridden system. This sets the stage for his argument: without proper problem definition, developers risk creating their own unmanageable “emu wars.”

He illustrates this with a hypothetical coding scenario where a client demands a solution to “kill all the pesky emus.” Developers might churn out classes and methods, only to face mounting complexity and bugs, such as emus “upgrading to T-Rexes.” The lesson? Simply writing more code doesn’t address the root issue, much like the Emu War’s flawed strategy failed to protect farmers’ crops.

Modeling Smells in E-Commerce

Transitioning to a more practical domain, Lee applies the Emu War analogy to an e-commerce platform tasked with implementing an “update order” feature. Initially, the solution seems straightforward: create an endpoint to modify orders. However, as Lee demonstrates, this leads to bugs like customers receiving too many items, being undercharged, or getting empty boxes. These issues arise because the vague “update order” requirement invites a cascade of edge cases and race conditions.

By examining the system’s event timeline, Lee highlights how an “order updated” event disrupts critical processes like payment capture and stock reservation. This modeling smell—where a generic action undermines system integrity—mirrors the Emu War’s misaligned objectives. The real problem, Lee argues, lies in failing to define the business’s true needs, resulting in a codebase that’s hard to test and extend.

Refining with Domain-Driven Design

Here, Lee introduces DDD as a remedy, emphasizing techniques like event storming and the five whys to uncover the true problem space. Revisiting the Emu War, he applies the five whys to reveal that the goal wasn’t to kill emus but to secure employment for returning soldiers. Similarly, in the e-commerce case, the “update order” request masks specific needs: ensuring shoppers receive only desired items, adding forgotten items, and canceling orders.

By reframing these needs, Lee proposes targeted solutions, such as a “supplementary order” endpoint for adding items and a time-bound “order received” event to allow cancellations without disrupting the system. These solutions, rooted in DDD’s ubiquitous language, reduce complexity by aligning the code with business intent, avoiding the pitfalls of generic actions like “update.”

Simplicity Through Abstraction

Lee challenges the notion that complex problems demand complex solutions. Through DDD, he shows how elevating the level of abstraction—by focusing on precise business goals—eliminates unnecessary complexity. In the e-commerce example, replacing the problematic “update order” endpoint with simpler, purpose-specific endpoints demonstrates how DDD fosters maintainable, extensible code.

He acknowledges the challenges of implementing such changes in live systems, where breaking changes can be daunting. However, Lee argues that aligning solutions with the problem space is worth the effort, as it prevents the codebase from becoming a “Frankenstein’s monster” burdened by accidental complexity.

Conclusion: Avoiding Your Own Emu War

Lee wraps up by urging developers to wield their coding “superpower” wisely. Instead of burying problems under an avalanche of code, he advocates for DDD practices to ensure solutions reflect the business’s true needs. By employing event storming, refining ubiquitous language, and questioning requirements with the five whys, developers can avoid fighting futile, unmaintainable battles.

This talk serves as a compelling reminder that thoughtful problem definition is the cornerstone of effective software development. Lee’s blend of humor and practical insights makes a strong case for embracing DDD to create robust, adaptable systems.

PostHeaderIcon [SpringIO2019] Managing Business Processes in Microservice Architecture with Spring Ecosystem by Bartłomiej Słota

In the dynamic landscape of software development, reconciling the structured demands of Business Process Management (BPM) with the flexibility of microservices presents both challenges and opportunities. At Spring I/O 2019 in Barcelona, Bartłomiej Słota, a seasoned consultant from Poland, delivered an insightful presentation on integrating BPM with microservices using the Spring ecosystem. Drawing from his experience at Batcave IT Minds and his work with Vattenfall, a Swedish energy company, Bartłomiej offered a compelling narrative on achieving autonomy and efficiency in business processes. This post explores his approach, emphasizing practical solutions for modern software architectures.

The Business Process Management Challenge

Business Process Management systems are pivotal for organizations aiming to streamline operations and enhance competitiveness. With a market valued at $8 billion and projected to reach $18.5 billion by 2025, companies invest heavily in BPM to optimize workflows and reduce costs. However, traditional BPM solutions often rely on monolithic architectures, which clash with the agile, decentralized nature of microservices. Bartłomiej introduced a fictional developer, Bruce, who faces the frustration of rigid systems, manual interventions, and low productivity. Bruce’s struggle mirrors real-world challenges where teams grapple with aligning business needs with technical agility.

The core issue lies in the inherent tension between the centralized control of BPM systems and the autonomy required for microservices. Traditional BPM architectures lack scalability, technology flexibility, and deployment independence, leading to inefficiencies. Bartłomiej proposed a solution: leveraging microservices to create autonomous, scalable, and resilient business processes, supported by tools like Apache Kafka and Spring Cloud Stream.

Achieving Autonomy Through Microservices

Microservices thrive on autonomy, which Bartłomiej described as a multidimensional vector encompassing scalability, deployment, data management, resilience, technology choice, and team dynamics. Scalability, for instance, extends beyond technical resources to organizational efficiency. Drawing from Robert C. Martin’s Clean Architecture, Bartłomiej highlighted how unchecked complexity can inflate development costs, with more engineers producing fewer lines of business logic per release. Microservices address this by allowing independent scaling of components, reducing organizational bottlenecks.

Deployment autonomy is equally critical. By decoupling services, teams can deploy updates independently, avoiding the all-or-nothing approach of monolithic systems. Bartłomiej emphasized high cohesion, ensuring each microservice focuses on specific business functionalities. This approach also extends to data management, where each service maintains its own database, enhancing autonomy and reducing dependencies. For Bruce, this meant breaking free from the constraints of a shared, generic database schema, enabling faster and safer changes.

Event Storming for Business Alignment

To bridge the gap between business and technical teams, Bartłomiej advocated for event storming, a collaborative workshop method that fosters a shared understanding of business processes. Unlike traditional BPMN diagrams, which may alienate non-technical stakeholders, event storming uses sticky notes to map processes in a way that’s accessible to all. Through a case study of an address change process, Bartłomiej demonstrated how event storming identifies key events—like authorization or AML checks—revealing inefficiencies and silos. This process helped Bruce’s team define clear bounded contexts, ensuring microservices remain cohesive and autonomous.

Event storming also mitigates the risks of Conway’s Law, where system design mirrors organizational communication patterns. By engaging stakeholders from various departments, teams can uncover where value is created or lost, aligning technical solutions with business goals. For Vattenfall, this approach facilitated the migration of their mobility platform to a Kubernetes-based microservice environment, enhancing scalability and user experience.

Orchestration and Spring Ecosystem Tools

Bartłomiej contrasted two communication patterns for microservices: choreography and orchestration. Choreography, where services emit and consume events independently, can lead to tight coupling when new processes are introduced. Instead, he recommended orchestration, where a dedicated process orchestrator manages workflows by sending commands and processing events. In the address change example, an orchestrator coordinates interactions between services like authorization, customer contact, and AML checks, ensuring flexibility and resilience.

Spring Cloud Stream and Apache Kafka play pivotal roles in this architecture. Spring Cloud Stream abstracts messaging complexities, enabling seamless communication via Kafka topics. Kafka’s consumer groups and topic partitioning enhance scalability, while Kafka Streams supports real-time data processing for tasks and reports. Bartłomiej showcased how Vattenfall uses Kafka Streams to build read models, offering business insights that surpass traditional BPM solutions. Additionally, tools like Spring Cloud Sleuth and Spring Cloud Contract ensure observability and reliable testing, critical for maintaining autonomous services.

Empowering Teams and Technology Choices

The success of microservices hinges on people. Bartłomiej stressed that organizational culture must empower teams to own processes end-to-end, fostering leadership and accountability. By assigning a single team to each business process, as identified through event storming, companies can minimize conflicts and enhance autonomy. This approach also allows teams to select technologies suited to their specific challenges, from Spring Data REST for lightweight APIs to Akka for complex workflows.

For Bruce, adopting these principles transformed his project. By embracing microservices, event storming, and Spring ecosystem tools, he addressed pain points, improved productivity, and aligned technical efforts with business value. Bartłomiej’s presentation underscores that integrating BPM with microservices is not just a technical endeavor but a cultural shift, enabling organizations to deliver competitive, scalable solutions.

Links: