对于想要学习Akka的Java 和 Scala 开发者们,有很多技术资源可供参考,但是如要想知道如何去应用这些技术就需要不同的思维方式了。为了帮助你正确地使用Akka,这本实用的实践指南提供了若干高级的设计模式,还包括了如何以及何时应用那些模式去解决在大型分布式系统中遇到的实际问题的一些案例。
目录
- 前言 .......................................................................................... xvii
- 第1 章 Actor 模型 ........................................................................1
- 现实是最终一致的 .................................................................................................1
- 解构Actor 模型 .....................................................................................................3
- 所有的计算都在一个actor 中执行 .........................................................................4
- actor 之间只能通过消息进行通信 .........................................................................5
- actor 可以创建子actor ...........................................................................................6
- actor 可以改变自己的状态或行为 .........................................................................8
- 一切都是actor .......................................................................................................9
- Actor 模型的使用 .................................................................................................10
- 定义清晰的边界 ................................................................................................... 11
- 何时适合使用Actor 模型 ....................................................................................13
- 结论 .....................................................................................................................13
- 第2 章 Akka 简介 .......................................................................15
- Akka 是什么......................................................................................................... 15
- Akka 是开源的 .............................................................................................. 15
- Akka 正在蓬勃发展 .......................................................................................16
- Akka 是为分布式设计的 ...............................................................................16
- Akka 组件 ............................................................................................................17
- Akka actor .....................................................................................................17
- 子actor .......................................................................................................... 18
- remoting :不同JVM 上的actor ....................................................................20
- clustering :集群成员的自动化管理 ..............................................................20
- Akka HTTP ...................................................................................................24
- TestKit ........................................................................................................... 25
- contrib ........................................................................................................... 25
- Akka OSGi ................................................................................................... 25
- Akka HTTP ...................................................................................................26
- Akka Streams ................................................................................................26
- Akka 实现的Actor 模型 ......................................................................................26
- Actor 模型中的Akka actor ..................................................................................26
- 消息传递 .......................................................................................................27
- actor 系统 ...................................................................................................... 28
- Akka Typed 项目 .................................................................................................. 28
- 结论 ....................................................................................................................29
- 第3 章 分布式领域驱动设计 ........................................................31
- DDD 概述 ............................................................................................................31
- DDD 的好处 .........................................................................................................32
- DDD 组件 ............................................................................................................33
- 域实体 ..................................................................................................................34
- 域值对象 .............................................................................................................34
- 聚合与聚合根 ..................................................................................................... 35
- 仓储 .....................................................................................................................37
- 工厂和对象创建 ................................................................................................... 38
- 域服务 .................................................................................................................. 38
- 有界上下文 ..........................................................................................................39
- 结论 ....................................................................................................................41
- 第4 章 优秀的Actor 设计 ...........................................................43
- 大系统小做 ..........................................................................................................43
- 封装actor 中的状态 ............................................................................................44
- 使用字段封装状态 .......................................................................................44
- 使用“状态”容器封装状态 ........................................................................47
- 使用become 封装状态 ................................................................................. 48
- 将futures 与actors 混合 ............................................................................... 50
- Ask 模式和替代方案 ............................................................................................ 54
- Ask 模式的问题 ........................................................................................... 55
- 附带的复杂性 ................................................................................................ 57
- Ask 的替代方案 ........................................................................................... 57
- 命令与事件 .......................................................................................................... 59
- 构造函数的依赖注入 ....................................................................................61
- 使用路径查找actor ......................................................................................61
- 结论 ....................................................................................................................62
- 第5 章 数据流 ............................................................................63
- 吞吐量与延迟 ......................................................................................................63
- 流 .........................................................................................................................64
- 路由器 ..................................................................................................................66
- 邮箱 ..................................................................................................................... 68
- 无界邮箱 ...................................................................................................... 68
- 有界邮箱 .............................................................................................