-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexternal.py
33 lines (29 loc) · 844 Bytes
/
external.py
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
33
# Public Part:
messages_paths: dict = {
'SIG': ('External', 'Sender'),
'MSG': ('Sender', 'Receiver'),
'REC': ('Receiver', 'Sender'),
'ACK': ('Sender', 'External')
}
machines_addresses: dict = {
'External': 'http://127.0.0.1:8001',
'Sender': 'http://127.0.0.1:8002',
'Receiver': 'http://127.0.0.1:8003'
}
# Private Part
listen_port: int = 8001
entity_type: str = 'External'
machine_name: str = entity_type
entity_default_data: dict = {}
messages_to_receive: dict = {
'ACK': (
lambda message_data, entity_data: print(message_data, entity_type),
(
[], lambda _: False, [] # `lambda _: False` means 'ACK' ends with no messages to be sent out.
)
)
}
# For External
begin_message: str = 'SIG'
def begin_message_to_entities_ids_chooser(entity_id, _):
return [entity_id]