1. Trang chủ
  2. » Công Nghệ Thông Tin

CQRS for java developers

72 69 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 72
Dung lượng 6,44 MB

Nội dung

CQRS and Event Sourcing for Java Developers Markus Eisele @myfear Agenda • • • • Classical architectures and modernization CRUD vs CQRS A little example Wrapping it up Classical Architectures Application Server EAR - Enterprise Archive Web UI Browser Mobile REST JAR JAR JAR RDBMS JAR JAR JAR JAR JAR JAR JAR > Traditional application architectures and platforms are obsolete Gartner More users Reactive Manifesto Microservices http://www.internetlivestats.com/internet-users/ Akka RoR Spring J2EE New requirements • • • • • Rather than acting on data at rest, modern software increasingly operates on data in near real-time Shortened time-frames for putting changes into production New business models evolve from existing ones New questions need to be answered by existing applications Datacenter costs need to go down constantly Which best describes the amount of data that your organization is dealing with, compared to two years ago? 14% We are dealing with MORE data 2% We are dealing with the SAME AMOUNT of data 84% We are dealing with LESS data Application Server Application Server Application Server EAR - Enterprise Archive Web UI Browser Mobile REST JAR JAR JAR RDBMS JAR JAR JAR JAR JAR JAR JAR For example: • • • • • Recreate bugs Migrate systems Introduce new read-sides Process higher volumes Extended caching scenarios BECAUSE the examples are based on LAGOM and it DOES A LOT MORE for you!! oO(you can try with Spring / Hibernate / Java EE – your choice) You’ve heard this before, but: • • • • • Lagom is asynchronous by default Developer productivity Build for microservices Takes you to production … oO(you can this with Spring / Hibernate / Java EE – your choice) When not to CQRS? Don’t CQRS when you… • • • • • don’t want eventual consistency have to do deletes (It gets messy) have no idea about your domain just have to store and retrieve a value … Links and further reading Project Site: http://www.lightbend.com/lagom GitHub Repo: https://github.com/lagom Documentation: http://www.lagomframework.com/documentation/1.3.x/java/Home.html Cargo Tracker Example: https://github.com/lagom/activator-lagom-cargotracker •Keep all data in memory! • Store all state changes as events • Replay all events of an actor to recreate it • Strong consistency for Actor (aggregate) and Journal • Eventual Consistency for Read Side https://msdn.microsoft.com/en-us/library/jj554200.aspx https://www.infoq.com/minibooks/domain-driven-design-quickly Written for architects and developers that must quickly gain a fundamental understanding of microservice-based architectures, this free O’Reilly report explores the journey from SOA to microservices, discusses approaches to dismantling your monolith, and reviews the key tenets of a Reactive microservice: • • • • • • • Isolate all the Things Act Autonomously Do One Thing, and Do It Well Own Your State, Exclusively Embrace Asynchronous Message-Passing Stay Mobile, but Addressable Collaborate as Systems to Solve Problems http://bit.ly/ReactiveMicroservice The detailed example in this report is based on Lagom, a new framework that helps you follow the requirements for building distributed, reactive systems • • • • Get an overview of the Reactive Programming model and basic requirements for developing reactive microservices Learn how to create base services, expose endpoints, and then connect them with a simple, web-based user interface Understand how to deal with persistence, state, and clients Use integration technologies to start a successful migration away from legacy systems http://bit.ly/DevelopReactiveMicroservice • Understand the challenges of starting a greenfield development vs tearing apart an existing brownfield application into services • Examine your business domain to see if microservices would be a good fit • Explore best practices for automation, high availability, data separation, and performance • Align your development teams around business capabilities and responsibilities • Inspect design patterns such as aggregator, proxy, pipeline, or shared resources to model service interactions http://bit.ly/SustainableEnterprise ... application must use Command Query Responsibility Segregation (CQRS) to implement queries This in turn means that applications must handle eventually consistent data CQRS • Command Query Responsibility Segregation CQRS means separating command... but only … • For simple domain models! • Complex models start to show weaknesses • DTO vs VO • Read vs Write performance • Optimistic Locking • Distributed Caches But what else? Effort to change / enhance... what else? Effort to change / enhance CQRS CRUD Complexity of Domain Model Commands and Queries • The Command – for Writes • e.g CreateCargo • The Query – for Reads • e.g ListCargo Just separating

Ngày đăng: 16/04/2019, 20:52

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN