Preface |
|
xi | |
Acknowledgments |
|
xii | |
About This Book |
|
xiii | |
About The Author |
|
xvi | |
About The Cover Illustration |
|
xvii | |
Part 1: The Road To Reactive |
|
|
|
3 | (8) |
|
1.1 The heart of the Reactive Manifesto |
|
|
4 | (2) |
|
1.2 Reactive systems vs. reactive programming |
|
|
6 | (1) |
|
|
7 | (1) |
|
|
7 | (1) |
|
Where not to use Akka.NET |
|
|
8 | (1) |
|
1.4 How does Akka.NET work? |
|
|
8 | (3) |
|
2 Reactive application design |
|
|
11 | (12) |
|
2.1 Basic reactive system design |
|
|
12 | (1) |
|
2.2 Reactive e-commerce application with actors |
|
|
13 | (6) |
|
|
13 | (2) |
|
Changing states of actors |
|
|
15 | (1) |
|
|
15 | (1) |
|
Data transfer between services |
|
|
16 | (1) |
|
Scaling work with routers |
|
|
17 | (1) |
|
|
18 | (1) |
|
2.3 Building on reactive foundations |
|
|
19 | (6) |
|
Publishing the e-commerce application to the world |
|
|
19 | (1) |
|
Storing state within actors |
|
|
20 | (1) |
|
Scaling out across a cluster of machines |
|
|
20 | (1) |
|
Continuing to react to environmental changes |
|
|
20 | (1) |
|
|
21 | (2) |
Part 2: Digging In |
|
23 | (126) |
|
3 Your first Akka.NET application |
|
|
25 | (18) |
|
3.1 Setting up an application |
|
|
26 | (1) |
|
|
26 | (7) |
|
What does an actor embody? |
|
|
26 | (2) |
|
|
28 | (1) |
|
|
29 | (4) |
|
|
33 | (1) |
|
|
33 | (3) |
|
|
33 | (2) |
|
|
35 | (1) |
|
|
36 | (1) |
|
3.4 Communicating with actors |
|
|
36 | (4) |
|
Actor addresses and references |
|
|
37 | (2) |
|
|
39 | (1) |
|
|
40 | (1) |
|
3.5 Case study: Actors, concurrency, and phone billing |
|
|
40 | (3) |
|
4 State, behavior, and actors |
|
|
43 | (16) |
|
4.1 Preparing for the next message |
|
|
44 | (1) |
|
4.2 Setting appropriate runtime behaviors |
|
|
44 | (3) |
|
|
45 | (1) |
|
|
45 | (2) |
|
|
47 | (1) |
|
4.3 Finite state machines |
|
|
47 | (10) |
|
Understanding finite state machines |
|
|
48 | (2) |
|
Using finite state machines in a concurrency model |
|
|
50 | (2) |
|
Converting a finite state machine into an actor |
|
|
52 | (2) |
|
Using the finite state machine actor |
|
|
54 | (3) |
|
|
57 | (1) |
|
4.4 Case study: State machines, states and events, marketing analytics campaign |
|
|
57 | (2) |
|
5 Configuration, dependency injection, and logging |
|
|
59 | (17) |
|
5.1 Why do you need configuration? |
|
|
60 | (1) |
|
5.2 Configuring an actor deployment |
|
|
60 | (4) |
|
|
61 | (2) |
|
|
63 | (1) |
|
5.3 Dependency injection (DI) |
|
|
64 | (3) |
|
Introducing dependency injection |
|
|
64 | (2) |
|
Configuring a DI container |
|
|
66 | (1) |
|
|
67 | (1) |
|
5.4 C8onfiguring with HOCON |
|
|
67 | (3) |
|
|
67 | (2) |
|
Loading configuration into an actor system |
|
|
69 | (1) |
|
|
70 | (1) |
|
|
70 | (3) |
|
|
70 | (1) |
|
|
71 | (1) |
|
Customizing a logger deployment |
|
|
72 | (1) |
|
|
73 | (1) |
|
5.6 Case study: Configuration and distributed systems |
|
|
73 | (3) |
|
|
76 | (27) |
|
6.1 Understanding failures |
|
|
77 | (1) |
|
6.2 Handling application-level failures |
|
|
78 | (18) |
|
Responding to application errors |
|
|
79 | (2) |
|
The Akka.NET supervision tree |
|
|
81 | (5) |
|
|
86 | (2) |
|
|
88 | (3) |
|
Watching for the deaths of other actors |
|
|
91 | (3) |
|
|
94 | (1) |
|
|
95 | (1) |
|
6.3 Understanding transport-level failures |
|
|
96 | (5) |
|
Writing applications that handle message loss |
|
|
97 | (4) |
|
|
101 | (1) |
|
6.4 Case study: Supervision, failure, chat hots |
|
|
101 | (2) |
|
7 Scaling in reactive systems |
|
|
103 | (24) |
|
7.1 Scaling up and scaling out |
|
|
104 | (2) |
|
|
106 | (5) |
|
|
106 | (3) |
|
|
109 | (2) |
|
|
111 | (1) |
|
|
111 | (14) |
|
|
112 | (1) |
|
|
113 | (1) |
|
|
114 | (2) |
|
|
116 | (4) |
|
Scatter-gather first-completed |
|
|
120 | (2) |
|
|
122 | (2) |
|
|
124 | (1) |
|
7.4 Case 8 study: Scaling, throughput, advertising systems |
|
|
125 | (2) |
|
8 Composing actor systems |
|
|
127 | (22) |
|
8.1 Introducing Akka.NET remoting |
|
|
129 | (1) |
|
8.2 Preparing to use remoting |
|
|
130 | (2) |
|
|
130 | (1) |
|
Configuring remoting for a project |
|
|
130 | (2) |
|
8.3 Communicating with remote actors |
|
|
132 | (5) |
|
Sending messages to remote actors |
|
|
133 | (2) |
|
Remote deployment of actors |
|
|
135 | (2) |
|
|
137 | (1) |
|
8.4 Elastic scale across machines |
|
|
137 | (3) |
|
Configuring a router to use multiple machines |
|
|
138 | (2) |
|
|
140 | (1) |
|
8.5 Failure handling across machines |
|
|
140 | (3) |
|
Supervisor strategies across a network |
|
|
141 | (1) |
|
|
142 | (1) |
|
|
143 | (1) |
|
|
143 | (4) |
|
Limiting messages that can be sent over the network |
|
|
144 | (1) |
|
Restricting available remote actor targets |
|
|
144 | (3) |
|
|
147 | (1) |
|
8.7 Case study: Remoting, network applications, web server, and backend server |
|
|
147 | (2) |
PART 3: Real-Life Usage |
|
149 | (102) |
|
9 Testing Akka.NET actors |
|
|
151 | (22) |
|
9.1 Introducing Akka.TestKit |
|
|
153 | (1) |
|
|
154 | (4) |
|
|
155 | (1) |
|
|
156 | (1) |
|
|
157 | (1) |
|
|
158 | (1) |
|
9.3 Integration testing actors |
|
|
158 | (6) |
|
Creating test specifications |
|
|
158 | (1) |
|
Asserting message responses |
|
|
159 | (2) |
|
|
161 | (2) |
|
|
163 | (1) |
|
|
164 | (1) |
|
9.4 Testing distributed applications with MultiNode TestKit |
|
|
164 | (7) |
|
|
165 | (2) |
|
Testing individual actor systems |
|
|
167 | (1) |
|
|
168 | (1) |
|
Testing for network failure |
|
|
169 | (2) |
|
|
171 | (1) |
|
9.5 Case study: Testing, test-driven development, unit testing |
|
|
171 | (2) |
|
|
173 | (19) |
|
10.1 Integrating with ASP.NET |
|
|
175 | (4) |
|
10.2 Integrating with SignalR |
|
|
179 | (5) |
|
Communicating through an actor |
|
|
180 | (2) |
|
Connecting to the user's web browser |
|
|
182 | (2) |
|
|
184 | (1) |
|
10.3 Custom integrations with akka.io |
|
|
184 | (6) |
|
Creating a listening socket |
|
|
185 | (3) |
|
Sending data through akka.io |
|
|
188 | (2) |
|
|
190 | (1) |
|
10.4 Case study: IO, integration, IoT applications |
|
|
190 | (2) |
|
11 Storing actor state with Akka.Persistence |
|
|
192 | (22) |
|
11.1 Understanding event sourcing |
|
|
193 | (2) |
|
11.2 Using Akka.Persistence |
|
|
195 | (6) |
|
|
195 | (4) |
|
|
199 | (2) |
|
|
201 | (1) |
|
11.3 Akka.Persistence performance tuning |
|
|
201 | (3) |
|
|
201 | (2) |
|
|
203 | (1) |
|
|
204 | (1) |
|
11.4 Akka.Persistence performance tuning |
|
|
204 | (8) |
|
|
204 | (4) |
|
Upgrade strategies for applications using event sourcing |
|
|
208 | (4) |
|
|
212 | (1) |
|
11.5 Case study: Persistence, storage, staged upgrades |
|
|
212 | (2) |
|
12 Building clustered applications with Akka.Cluster |
|
|
214 | (29) |
|
12.1 Introducing Akka.Cluster |
|
|
215 | (4) |
|
12.2 Cluster-aware routers |
|
|
219 | (4) |
|
Creating cluster-aware router groups |
|
|
219 | (3) |
|
Creating cluster-aware router pools |
|
|
222 | (1) |
|
|
223 | (1) |
|
12.3 Working with cluster gossip |
|
|
223 | (2) |
|
|
224 | (1) |
|
Handling cluster gossip messages |
|
|
224 | (1) |
|
|
225 | (1) |
|
|
225 | (3) |
|
|
228 | (1) |
|
|
228 | (5) |
|
|
229 | (3) |
|
Communicating with actors in a shard |
|
|
232 | (1) |
|
Handling passivation in shards |
|
|
233 | (1) |
|
|
233 | (1) |
|
12.6 Distributed publish-subscribe |
|
|
233 | (5) |
|
|
234 | (2) |
|
|
236 | (1) |
|
|
237 | (1) |
|
|
238 | (3) |
|
12.8 Case study: Clustering, scaling, cluster management |
|
|
241 | (2) |
|
13 Akka.NET and reactive programming in production |
|
|
243 | (8) |
|
13.1 Designing with actors |
|
|
244 | (1) |
|
|
245 | (1) |
|
|
246 | (1) |
|
13.4 Handling configuration |
|
|
247 | (1) |
|
|
247 | (1) |
|
|
248 | (1) |
|
13.7 Real-time integration |
|
|
249 | (1) |
|
|
249 | (1) |
|
|
250 | (1) |
|
|
250 | (1) |
Index |
|
251 | |