diff --git a/monkey/monkey_island/cc/setup/island_event_handlers.py b/monkey/monkey_island/cc/setup/island_event_handlers.py index ee37568f1..fa036a8fe 100644 --- a/monkey/monkey_island/cc/setup/island_event_handlers.py +++ b/monkey/monkey_island/cc/setup/island_event_handlers.py @@ -3,6 +3,7 @@ from functools import partial from common import DIContainer from monkey_island.cc.event_queue import IIslandEventQueue, IslandEventTopic from monkey_island.cc.island_event_handlers import ( + handle_agent_registration, reset_agent_configuration, reset_machine_repository, set_agent_configuration_per_island_mode, @@ -20,11 +21,20 @@ from monkey_island.cc.services.database import Database def setup_island_event_handlers(container: DIContainer): island_event_queue = container.resolve(IIslandEventQueue) + _subscribe_agent_registration_events(island_event_queue, container) _subscribe_reset_agent_configuration_events(island_event_queue, container) _subscribe_clear_simulation_data_events(island_event_queue, container) _subscribe_set_island_mode_events(island_event_queue, container) +def _subscribe_agent_registration_events( + island_event_queue: IIslandEventQueue, container: DIContainer +): + topic = IslandEventTopic.AGENT_CONNECTED + + island_event_queue.subscribe(topic, container.resolve(handle_agent_registration)) + + def _subscribe_reset_agent_configuration_events( island_event_queue: IIslandEventQueue, container: DIContainer ):