Skip to Content
语义软件设计
book

语义软件设计

by Eben Hewitt
September 2022
Beginner to intermediate
321 pages
4h 50m
Chinese
China Electric Power Press Ltd.
Content preview from 语义软件设计
应用程序
169
7.15.4
数据访问器
所有的数据访问都必须通过服务
API
。这些服务称作“数据访问器”。数据访问器
服务由引擎调用,与数据存储交互,帮助引擎完成工作。
我们将在第
8
章详细介绍,因为数据访问器本身是一个很大的话题。此处提到这个
概念只是为了上下文完整。暂时,你只需要知道这些服务名叫数据访问器,是与引
擎不同的服务。
7.16
事件处理
最基本的异步处理形式是就发布和订阅。一个组件是事件生产者,将事件发布到队
列或主题。这里的队列负责存储事件,并允许另一个组件(订阅者)异步读取事件。
主题就像一个队列,允许多个订阅者接收事件。
将事件发布到主题的思想是解构设计中的一个关键。基本来说,事件有多个订阅者,
他们来去自由(订阅和取消订阅),可以根据自己的时间,以某种事件生产者并不
知道的方式自由处理事件,对于我们设计的许多概念来说,这是一个完美的工具。
因为我们不清楚什么是“正确的”响应(或假设只有一个响应),而且我们希望系
统具有出色的可扩展性,而发布
/
订阅事件完全符合这种要求。这种架构可以将假
设降到最少,并提供最大程度的可伸缩性、灵活性、可扩展性、松耦合和可移植性。
这种模式的核心是事件。每个事件都应该用相同的方式来表示,即某个名词刚刚发
生的状态变化。举个例子,对于酒店业务,你可以认为“客人退房”是一个重要事件,
其他事件还有“下单”或“取消预订”等。请注意,任何曾经住过酒店的人都知道
这些事件。在目前这个阶段,将事件描述到这种程度就足够了:非技术,面向业务。
你只需花几分钟列出领域内的一些重大事件。 ...
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

金融中的人工智能

金融中的人工智能

Posts & Telecom Press, Jeffrey Ng, Subhash Shah
移动端机器学习实战

移动端机器学习实战

Posts & Telecom Press, Karthikeyan NG
精通数据科学算法

精通数据科学算法

Posts & Telecom Press, David Natingga

Publisher Resources

ISBN: 9787519870300