Death Watch
Monitor actors and react when they terminate.
Overview
Death watch allows actors to be notified when other actors terminate. When a watched actor stops (normally or due to failure), watchers receive a Terminated message.
1
2
3
4
5
6
Watching Actors
Use ctx.watch() to monitor another actor:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Watching Multiple Actors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Common Use Cases
Connection Management
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Dependency Tracking
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Child vs Watched Actors
| Aspect | Child Actors | Watched Actors |
|---|---|---|
| Created by | ctx.spawn_child() | ctx.watch() |
| Auto-stopped | Yes, when parent stops | No |
| Supervision | Yes, restart strategies apply | No |
| Termination notice | Yes, via Terminated | Yes, via Terminated |
