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

微服务与事件驱动架构

by Adam Bellemare
October 2021
Beginner to intermediate
250 pages
7h 11m
Chinese
Posts & Telecom Press
Content preview from 微服务与事件驱动架构
78
6
续节点。有多个输入的节点,比如
aggregate
,从多个上游输入中消费事件和水位。节点
的事件时间是其所有输入源事件时间的
最小值
,节点会在内部保持对这些时间的跟踪(参
见图
6-4
2)
)。
在这个例子中,一旦来自
groupByKey-1
节点的水位到达,两个
aggregate
节点都会将它们
的事件时间从
13
更新到
15
(参见图
6-4
3)
处)
。注意,水位并不会影响节点的事件调
度,它只是告知节点,所有时间戳早于水位的事件都应该被认为是迟到的事件。本章的后
面部分会介绍处理迟到事件的内容。
Spark
Flink
Beam
等重量级处理框架需要一个专用的处理资源集群来大规模地执行流
处理。这一点特别重要,因为这个集群还提供了跨任务通信和集中协调每个处理任务的方
法。对事件的再分区,比如这个例子中的
groupByKey
+
aggregate
操作,在事件代理中使用
集群内部通信而不是事件流的方式实现。
6.5
 流时间
在流处理程序中维护时间的第二个选项,就是所谓的
流时间
,它是
Apache Kafka
流所推崇
的方法。从一个或多个事件流中读取数据的消费者应用程序维护着其拓扑的流时间,它是
所有已被处理事件的最大时间戳。消费者实例从每个分配给它的事件流分区中消费并缓存
事件,应用事件调度算法选择下一个要处理的事件,然后如果要处理的事件时间戳大于之
前的流时间,则更新流时间。流时间永远不会递减。
6-5
展示了一个流时间的例子
。消费者节点基于其接收到的最大事件时间值维护着一个
单一的流时间。这个流时间目前设为
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

成為卓越程式設計師的38項必修法則

成為卓越程式設計師的38項必修法則

Pete Goodliffe
下一代空间计算:AR与VR创新理论与实践

下一代空间计算:AR与VR创新理论与实践

Erin Pangilinan, Steve Lukas, Vasanth Mohan

Publisher Resources

ISBN: 9787115571106