Skip to Content
微服务与事件驱动架构
book

微服务与事件驱动架构

by Adam Bellemare
October 2021
Beginner to intermediate
250 pages
7h 11m
Chinese
Posts & Telecom Press
Content preview from 微服务与事件驱动架构
通信和数据契约
33
3.1.3
 全能的
schema
演化
schema
格式必须支持一整套
schema
演化规则。
schema
演化使生产者能够更新其服务的输
出格式,同时允许消费者继续不间断地消费事件。业务变更可能需要添加新字段、弃用旧
字段或扩展字段范围。
schema
演化框架确保这些变更可以安全地发生
,并且生产者和消费
者可以相互独立地更新。
如果没有
schema
演化的支持
,那么服务更新可能会有很高的代价。生产者和消费者被迫
密切协调,以前兼容的旧数据可能不再与当前系统兼容。当生产者更改数据
schema
时,
期望消费者更新他们的服务是不合理的。事实上,微服务的核心价值主张是,除非在特殊
情况下,否则它们应该独立于其他服务的发布周期。
一组显式的
schema
演化规则可以让消费者和生产者按照自己的时间安排更新应用程序
这些规则称为
兼容性类型
向前兼容性
允许像读取旧
schema
生成的数据一样读取新
schema
生成的数据
。在事件驱动架构中,
这是一个特别有用的演化需求,因为最常见的系统变更模式是从生产者用新的
schema
更新其数据定义并生成数据开始的。消费者只需要在访问新字段时更新其
schema
副本
和代码。
向后兼容性
允许像读取新
schema
生成的数据一样读取旧
schema
生成的数据
。这使得数据消费者可
以用新的
schema
读取旧的数据。向后兼容性对于以下场景来说特别有用。
消费者正在等待上游团队发布新特性。如果新的
schema
已被定义
,那么消费者就
可以在生产者发布之前发布自己的更新。
schema
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

监控运维实践:原则与策略

监控运维实践:原则与策略

Mike Julian
Kafka权威指南

Kafka权威指南

Neha Narkhede, Gwen Shapira, Todd Palino
Web容量规划之美

Web容量规划之美

Arun Kejariwal, John Allspaw

Publisher Resources

ISBN: 9787115571106