mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-13 22:16:03 +00:00
docs: Content SEO updates (#2990)
* update yaml frontmatter format * update abstract document * update abstract factory * use the new pattern template * acyclic visitor seo * adapter seo * ambassador seo * acl seo * aaa seo * async method invocation seo * balking seo * bridge seo * builder seo * business delegate and bytecode seo * caching seo * callback seo * chain seo * update headings * circuit breaker seo * client session + collecting parameter seo * collection pipeline seo * combinator SEO * command seo * cqrs seo * commander seo * component seo * composite seo * composite entity seo * composite view seo * context object seo * converter seo * crtp seo * currying seo * dao seo * data bus seo * data locality seo * data mapper seo * dto seo * decorator seo * delegation seo * di seo * dirty flag seo * domain model seo * double buffer seo * double checked locking seo * double dispatch seo * dynamic proxy seo * event aggregator seo * event-based asynchronous seo * eda seo * event queue seo * event sourcing seo * execute around seo * extension objects seo * facade seo * factory seo * factory kit seo * factory method seo * fanout/fanin seo * feature toggle seo * filterer seo * fluent interface seo * flux seo * flyweight seo * front controller seo * function composition seo * game loop seo * gateway seo * guarded suspension seo * half-sync/half-async seo * health check seo * hexagonal seo * identity map seo * intercepting filter seo * interpreter seo * iterator seo * layers seo * lazy loading seo * leader election seo * leader/followers seo * lockable object seo * rename and add seo for marker interface * master-worker seo * mediator seo * memento seo * metadata mapping seo * microservice aggregator seo * api gw seo * microservices log aggregration seo * mvc seo * mvi seo * mvp seo * mvvm seo * monad seo * monitor seo * monostate seo * multiton seo * mute idiom seo * naked objects & notification seo * null object seo * object mother seo * object pool seo * observer seo * optimistic locking seo * page controller seo * page object seo * parameter object seo * partial response seo * pipeline seo * poison pill seo * presentation model seo * private class data seo * producer-consumer seo * promise seo * property seo * prototype seo * proxy seo * queue-based load leveling seo * reactor seo * registry seo * repository seo * RAII seo * retry seo * role object seo * saga seo * separated interface seo * serialized entity seo * serialized lob seo * servant seo * server session seo * service layer seo * service locator seo * service to worker seo * sharding seo * single table inheritance seo * singleton seo * spatial partition seo * special case seo * specification seo * state seo * step builder seo * strangler seo * strategy seo * subclass sandbox seo * table module seo * template method seo * throttling seo * tolerant reader seo * trampoline seo * transaction script seo * twin seo * type object seo * unit of work seo * update method seo * value object seo * version number seo * virtual proxy seo * visitor seo * seo enhancements * seo improvements * SEO enhancements * SEO improvements * SEO additions * SEO improvements * more SEO improvements * rename hexagonal + SEO improvements * SEO improvements * more SEO stuff * SEO improvements * SEO optimizations * SEO enhancements * enchance SEO * improve SEO * SEO improvements * update headers
This commit is contained in:
1 parent
cb946c0cdc
commit
6cd2d0353a
219 files changed
+3308
-2819
No files matched your search
+23
-17
@@ -1,15 +1,21 @@
|
||||
---
|
||||
title: Event Sourcing
|
||||
title: "Event Sourcing Pattern in Java: Building Immutable Historical Records for Robust Systems"
|
||||
shortTitle: Event Sourcing
|
||||
description: "Discover the Event Sourcing design pattern in Java. Learn how it stores state changes as events and benefits complex applications. See examples and explanations on Java Design Patterns."
|
||||
category: Architectural
|
||||
language: en
|
||||
tag:
|
||||
- Decoupling
|
||||
- Event-driven
|
||||
- Fault tolerance
|
||||
- Messaging
|
||||
- Persistence
|
||||
- Scalability
|
||||
- Transactions
|
||||
- Decoupling
|
||||
- Event-driven
|
||||
- Fault tolerance
|
||||
- Messaging
|
||||
- Persistence
|
||||
- Scalability
|
||||
- Transactions
|
||||
head:
|
||||
- - meta
|
||||
- name: keywords
|
||||
content:
|
||||
---
|
||||
|
||||
## Also known as
|
||||
@@ -17,11 +23,11 @@ tag:
|
||||
* Event Logging
|
||||
* Event Streaming
|
||||
|
||||
## Intent
|
||||
## Intent of Event Sourcing Design Pattern
|
||||
|
||||
Event Sourcing is a design pattern that advocates for the storage of state changes as a sequence of events. Instead of updating a record in a database, all changes are stored as individual events which, when replayed, can recreate the state of an application at any point in time.
|
||||
|
||||
## Explanation
|
||||
## Detailed Explanation of Event Sourcing Pattern with Real-World Examples
|
||||
|
||||
Real-world example
|
||||
|
||||
@@ -35,7 +41,7 @@ In plain words
|
||||
|
||||
> The Event Sourcing pattern defines an approach to handling operations on data that's driven by a sequence of events, each of which is recorded in an append-only store. Application code sends a series of events that imperatively describe each action that has occurred on the data to the event store, where they're persisted. Each event represents a set of changes to the data (such as AddedItemToOrder).
|
||||
|
||||
**Programmatic Example**
|
||||
## Programmatic Example of Event Sourcing Pattern in Java
|
||||
|
||||
In the programmatic example we transfer some money between bank accounts.
|
||||
|
||||
@@ -194,20 +200,20 @@ Running the example produces the following console output.
|
||||
|
||||
In this example, the state of the system can be recreated at any point by replaying the events in the queue. This is a key feature of the Event Sourcing pattern.
|
||||
|
||||
## Applicability
|
||||
## When to Use the Event Sourcing Pattern in Java
|
||||
|
||||
* In systems where complete audit trails and historical changes are crucial.
|
||||
* In complex domains where the state of an application is derived from a series of changes.
|
||||
* For systems that benefit from high availability and scalability as Event Sourcing naturally lends itself to distributed systems.
|
||||
|
||||
## Known Uses
|
||||
## Real-World Applications of Event Sourcing Pattern in Java
|
||||
|
||||
* Financial systems to track transactions and account balances over time.
|
||||
* E-commerce applications for order and inventory management.
|
||||
* Real-time data processing systems where event consistency and replayability are critical.
|
||||
* [The LMAX Architecture](https://martinfowler.com/articles/lmax.html)
|
||||
|
||||
## Consequences
|
||||
## Benefits and Trade-offs of Event Sourcing Pattern
|
||||
|
||||
Benefits:
|
||||
|
||||
@@ -215,18 +221,18 @@ Benefits:
|
||||
* Replayability: Events can be reprocessed to recreate historical states or move to new states.
|
||||
* Scalability: Events can be processed asynchronously and in parallel.
|
||||
|
||||
## Trade-offs
|
||||
Trade-offs
|
||||
|
||||
* Complexity: Implementing and maintaining an event-sourced system can introduce additional complexity.
|
||||
* Event store size: Storing every state change can lead to large data volumes.
|
||||
* Event versioning: Changes in event structure over time require careful handling to ensure system integrity.
|
||||
|
||||
## Related Patterns
|
||||
## Related Java Design Patterns
|
||||
|
||||
* [Command Query Responsibility Segregation (CQRS)](https://java-design-patterns.com/patterns/cqrs/): Often used together with Event Sourcing to separate read and write responsibilities, enhancing performance and scalability.
|
||||
* Snapshot: Used to optimize Event Sourcing systems by periodically saving the current state to avoid replaying a long sequence of events.
|
||||
|
||||
## Credits
|
||||
## References and Credits
|
||||
|
||||
* [Building Microservices: Designing Fine-Grained Systems](https://amzn.to/443WfiS)
|
||||
* [Implementing Domain-Driven Design](https://amzn.to/3JgvA8V)
|
||||
|
||||
Reference in new issue
Block a user