Remote Actors
Send messages to actors running on different nodes over TCP.
Overview
cineyma's remote module enables actors to communicate across network boundaries using TCP and Protocol Buffers serialization:
- TCP transport with persistent connections
- Protocol Buffers for efficient serialization
- Request-response and fire-and-forget patterns
- Message routing to multiple actor types
Enable Remote Feature
Cargo.toml
toml1
2
3
4
5
6
Defining Remote Messages
Messages that can be sent remotely must implement RemoteMessage:
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
Use .proto files with prost-build for complex message types. This ensures consistent serialization across languages.
Setting Up a Remote Node
server.rs
rust1
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
33
34
35
36
37
38
39
40
41
Sending Remote Messages
client.rs
rust1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Message Routing
Route different message types to different actors:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Connection Management
Remote clients use correlation IDs to multiplex multiple concurrent requests over a single TCP connection:
1
2
3
4
5
6
7
8
9
10
11
