Message Trait
Define typed messages that actors can send and receive.
Message
The base trait for all messages. Messages define what data is sent and what response type is expected.
1
2
3
4
Required Bounds
SendMessage must be safe to send between threads'staticMessage cannot contain non-static referencesAssociated Types
type Result: SendThe response type returned by the handler. Must also be Send.Defining Messages
Message with Response
1
2
3
4
5
6
7
8
9
10
11
12
13
Fire-and-Forget Message
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Message with Result Type
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Terminated
Built-in message sent to watchers when a watched actor stops.
1
2
3
4
5
6
7
8
9
10
Usage with Death Watch
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
Common Patterns
Request-Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Command Pattern
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Broadcast Pattern
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Remote Messages
For messages sent over the network, implement RemoteMessage and use Protocol Buffers:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
