Skip to Content
Dapr学习手册
book

Dapr学习手册

by Haishi Bai, Yaron Schneider
November 2021
Beginner to intermediate
239 pages
4h 15m
Chinese
China Electric Power Press Ltd.
Content preview from Dapr学习手册
服务
65
1.4.3
发布
/
订阅的工作方式
发布
/
订阅需要一个信息主干。然而,正如在介绍一节中所解释的,
Dapr
设计原则之一是不重新发明轮子。因此,
Dapr
并没有创建一个新的信息骨干,
而是设计成可以与许多流行的信息骨干兼容,包括
Redis Streams
NATS
Azure Service Bus
RabbitMQ
Kafka
[
关于完整的列表,请参见
Dapr
库(
https://oreil.ly/Qnt8D
]
Dapr
使用
Redis Streams
作为默认的信息骨干。
Stream
Redis 5.0
引入的一
种只能附加的数据结构。你可以使用
XADD
将数据元素添加到
Stream
中,
也可以使用
BLPOP
API
来检索数据。每个订阅者都被分配有自己的消费组
consumer group
),这样他们就可以并行处理自己的消息副本。
Dapr
遵循
CloudEvents v1.0
规范
(
https://oreil.ly/f8tVe
)
。在撰写本书时,
CloudEvents
Cloud Native Computing Foundation (CNCF)
的沙盒级项
,
它的目标是创建一种用来描述事件的一致性方式,这种方式可以在事
件生产者和消费者之间使用。
Dapr
实现了所有需要的属性:
id
source
specversion
type
。它还实现了可选的
datacontenttype
subject
属性。
1-1
所示的
CloudEvents
属性列表显示了这些属性是如何被填充的。
1
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

流畅的Python(第2版)

流畅的Python(第2版)

Luciano Ramalho
数据科学原理

数据科学原理

Posts & Telecom Press, Sinan Ozdemir
Python预测分析实战

Python预测分析实战

Posts & Telecom Press, Alvaro Fuentes
机器学习开发者指南

机器学习开发者指南

Posts & Telecom Press, Rodolfo Bonnin

Publisher Resources

ISBN: 9787519859367