Event Sourcing with Reactor and Spring Statemachine

Jimmy Lu

Software Engineer
Digital River, Inc.

Jimmy Lu (盧松筠) is currently working at Digital River, Inc. as a software engineer in catalog team. He has four years of experience on implementing Spring-based applications. He mainly focuses on building microservices related infrastructures. He loves to code and is recently interested in reactive programming and distributed systems. He would like to make more contributions to communities in the future.

Event sourcing is an architectural pattern that introduces the concept of treating mutations of data in a domain as events and stores them in an append-only store rather than merely maintaining current state. It provides a way to achieve transaction consistency in the distributed system and natively support audit history. Immutable events also act as the source of truth for various materialised views. It helps to improve performance, scalability, and responsiveness of a system.
Reactor is a foundational library for building reactive fast-data applications on the JVM. It implements Reactive Streams Specification and builds on top of LMAX Disruptor which makes it a great fit for building low latency and high throughput application. On the other hand, Spring Statemachine is a framework for application developers to use state machine concepts with Spring applications. Except flat one level state machine, Spring Statemachine also provides concepts of nested state machine, regions for parallel state processing, and most importantly, distributed state machine across JVM boundaries to facilitate the work to apply state machine in complex systems.
In this talk, I’ll provide some background of event sourcing, introduce modules in Reactor and the concepts provided by Spring Statemachine. And lastly describe how we leverage both of frameworks to power our own event sourcing application.

1. 本場次為中文