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

AspectChild ActorsWatched Actors
Created byctx.spawn_child()ctx.watch()
Auto-stoppedYes, when parent stopsNo
SupervisionYes, restart strategies applyNo
Termination noticeYes, via TerminatedYes, via Terminated

Next Steps