Просмотр исходного кода

Rename event processor (#2657)

* clean Refman

(cherry picked from commit f72388dd288378caf30d6264a3b4b99ecfb385fa)

* Rename EventConsumer to EventProcessor

(cherry picked from commit 82d9bc35f1746f59d47f433d54038b773c46072d)
Jean-Robin 1 день назад
Родитель
Сommit
edffae9a58

+ 1 - 0
taipy/common/_check_dependencies.py

@@ -39,6 +39,7 @@ def _check_dependency_is_installed(
 
 
 class EnterpriseEditionUtils:
+    """NOT DOCUMENTED"""
     _TAIPY_ENTERPRISE_MODULE = "taipy.enterprise"
     _TAIPY_ENTERPRISE_CORE_MODULE = _TAIPY_ENTERPRISE_MODULE + ".core"
     _TAIPY_ENTERPRISE_EVENT_PACKAGE = _TAIPY_ENTERPRISE_MODULE + ".event"

+ 2 - 2
taipy/core/notification/__init__.py

@@ -19,8 +19,8 @@ To subscribe, a consumer needs to invoke the `Notifier.register()^` method.
 This call will yield a `RegistrationId` and a dedicated event queue for
 receiving notifications.
 
-To handle notifications, an event consumer (e.g., the `CoreEventConsumerBase^`
-object) must be instantiated with an associated event queue.
+To handle notifications, an event processor can be instantiated with an associated
+event queue. See (`EventProcessor^` for more details).
 """
 
 from ._registration import _Registration

+ 2 - 2
taipy/core/notification/core_event_consumer.py

@@ -22,9 +22,9 @@ class CoreEventConsumerBase(_CoreEventConsumerBase):
 
     def __init__(self, registration_id: str, queue: SimpleQueue) -> None:
         _warn_deprecated(deprecated="CoreEventConsumerBase",
-                         suggest="The 'taipy.event.event_consumer.GuiEventConsumer' class")
+                         suggest="The 'taipy.event.event_processor.EventProcessor' class")
         self.__logger.warning(
             "The `CoreEventConsumerBase` class is deprecated since taipy 4.1.0. "
-            "Please use the `GuiEventConsumer^` class instead."
+            "Please use the `EventProcessor^` class instead."
         )
         super().__init__(registration_id, queue)

+ 1 - 1
taipy/event/__init__.py

@@ -14,4 +14,4 @@
 This package provides classes and objects to handle Taipy events and trigger actions in response to these events."""
 
 from ..core.notification.event import Event, EventEntityType, EventOperation
-from .event_consumer import GuiEventConsumer
+from .event_processor import EventProcessor

+ 3 - 3
taipy/event/_event_processor.py

@@ -18,12 +18,12 @@ class _AbstractEventProcessor:
 
     @classmethod
     @abstractmethod
-    def process_event(cls, event_consumer, event: Event):
+    def process_event(cls, event_processor, event: Event):
         raise NotImplementedError("Subclasses must implement this method.")
 
 class _EventProcessor(_AbstractEventProcessor):
 
     @classmethod
-    def process_event(cls, event_consumer, event: Event):
-        event_consumer._process_event(event)
+    def process_event(cls, event_processor, event: Event):
+        event_processor._process_event(event)
 

+ 155 - 148
taipy/event/event_consumer.py → taipy/event/event_processor.py

@@ -27,21 +27,20 @@ from taipy.core.notification import (
 from taipy.core.notification._core_event_consumer import _CoreEventConsumerBase
 from taipy.event._event_callback import _Callback
 from taipy.event._event_processor import _AbstractEventProcessor, _EventProcessor
-from taipy.exceptions import NoGuiDefinedInEventConsumer
+from taipy.event.exceptions.exceptions import NoGuiDefinedInEventProcessor
 
 
-class GuiEventConsumer(_CoreEventConsumerBase):
-    """
-    The Taipy event consumer service.
+class EventProcessor(_CoreEventConsumerBase):
+    """The Taipy event processor service.
 
     This service listens for events in a Taipy application and triggers callback
     executions when events matching specific topics are produced. The service handle
     both cases where callbacks are broadcast to all states or executed once on the
     server side.
 
-    The main method to use is `on_event()^`, that registers a callback to a topic.
+    The main method to use is `on_event()`, that registers a callback to a topic.
 
-    Before starting the event consumer service, register each callback to a topic.
+    Before starting the event processor service, register each callback to a topic.
     The topics are defined by the entity type, the entity id, the operation, and the
     attribute name of the events. If an event matching the provided topic is produced,
     the callback execution is triggered.
@@ -66,7 +65,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
         When registering a callback, you can specify if the callback is automatically
         broadcast to all states. In this case, the first argument of the callback must be
-        the state otherwise it is the `GUI^` instance. The second argument is the event.
+        the state otherwise it is the `Gui^` instance. The second argument is the event.
         Optionally, the callback can accept more extra arguments (see the `callback_args`
         argument).
 
@@ -75,21 +74,21 @@ class GuiEventConsumer(_CoreEventConsumerBase):
         === "One callback to match all events"
 
             ```python
-            from taipy import Event, GuiEventConsumer, Gui
+            from taipy import Event, EventProcessor, Gui
 
             def event_received(gui: Gui, event: Event):
                 print(f"Received event created at : {event.creation_date}")
 
             if __name__ == "__main__":
-                event_consumer = GuiEventConsumer()
-                event_consumer.on_event(callback=event_received)
-                event_consumer.start()
+                event_processor = EventProcessor()
+                event_processor.on_event(callback=event_received)
+                event_processor.start()
             ```
 
         === "Two callbacks to match different topics"
 
             ```python
-            from taipy import Event, GuiEventConsumer, Gui
+            from taipy import Event, EventProcessor, Gui
 
             def on_entity_creation(event: Event, gui: Gui):
                 print(f" {event.entity_type} entity created at {event.creation_date}")
@@ -98,17 +97,17 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 print(f"Scenario '{event.entity_id}' processed for a '{event.operation}' operation.")
 
             if __name__ == "__main__":
-                event_consumer = GuiEventConsumer()
-                event_consumer.on_event(callback=on_entity_creation, operation=EventOperation.CREATION)
-                event_consumer.on_event(callback=scenario_event, entity_type=EventEntityType.SCENARIO)
-                event_consumer.start()
+                event_processor = EventProcessor()
+                event_processor.on_event(callback=on_entity_creation, operation=EventOperation.CREATION)
+                event_processor.on_event(callback=scenario_event, entity_type=EventEntityType.SCENARIO)
+                event_processor.start()
             ```
 
         === "Callbacks to be broadcast to all states"
 
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui
+            from taipy import Event, EventProcessor, Gui
 
             def event_received(state, event: Event):
                 scenario = tp.get(event.entity_id)
@@ -116,9 +115,9 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.broadcast_on_event(callback=event_received)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.broadcast_on_event(callback=event_received)
+                event_processor.start()
                 taipy.run(gui)
             ```
 
@@ -126,7 +125,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
 
             def print_scenario_created(event: Event, scenario: Scenario, gui: Gui):
                 print(f"Scenario '{scenario.name}' created at '{event.creation_date}'.")
@@ -137,10 +136,10 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.on_scenario_created(callback=print_scenario_created)
-                event_consumer.broadcast_on_scenario_created(callback=store_latest_scenario)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.on_scenario_created(callback=print_scenario_created)
+                event_processor.broadcast_on_scenario_created(callback=store_latest_scenario)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -149,7 +148,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui
+            from taipy import Event, EventProcessor, Gui
 
             def cycle_filter(event: Event, gui: Gui):
                 scenario = tp.get(event.entity_id)
@@ -162,22 +161,22 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.broadcast_on_event(
+                event_processor = EventProcessor(gui)
+                event_processor.broadcast_on_event(
                     callback=event_received,
                     entity_type=EventEntityType.SCENARIO,
                     filter=cycle_filter)
-                event_consumer.start()
+                event_processor.start()
                 taipy.run(gui)
             ```
 
-    Others methods such as `on_data_node_written()^` or `on_submission_finished()^` are
+    Others methods such as `on_data_node_written()` or `on_submission_finished()` are
     utility methods as shortcuts to easily register callbacks for predefined topics and
     filters.
     """
 
     def __init__(self, gui: Optional[Gui] = None) -> None:
-        """Initialize the Gui Event Consumer service.
+        """Initialize the Event Processor service.
 
         Arguments:
             gui (Gui): The Gui instance used to broadcast the callbacks to all states.
@@ -202,7 +201,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
         operation: Optional[EventOperation] = None,
         attribute_name: Optional[str] = None,
         filter: Optional[Callable[[Event], bool]] = None,
-    ) -> "GuiEventConsumer":
+    ) -> "EventProcessor":
         """Register a callback to be executed on a specific event.
 
         Arguments:
@@ -230,7 +229,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 as the only argument and return a boolean. If the filter returns False, the
                 callback is not triggered.
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_event(
             callback=callback,
@@ -252,7 +251,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
         operation: Optional[EventOperation] = None,
         attribute_name: Optional[str] = None,
         filter: Optional[Callable[[Event], bool]] = None,
-    ) -> "GuiEventConsumer":
+    ) -> "EventProcessor":
         """Register a callback to be broadcast to all states on a specific event.
 
                 Arguments:
@@ -280,7 +279,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                         as the only argument and return a boolean. If the filter returns False, the
                         callback is not triggered.
                 Returns:
-                    GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+                    EventProcessor: The current instance of the `EventProcessor` service.
                 """
         return self.__on_event(
             callback=callback,
@@ -303,7 +302,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
         attribute_name: Optional[str] = None,
         filter: Optional[Callable[[Event], bool]] = None,
         broadcast: bool = False,
-    ) -> "GuiEventConsumer":
+    ) -> "EventProcessor":
         topic = self.__build_topic(entity_type, entity_id, operation, attribute_name)
         cb = self.__build_callback(callback, callback_args, filter, broadcast)
         self.__register_callback(topic, cb)
@@ -313,25 +312,25 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                             callback: Callable,
                             callback_args: Optional[List] = None,
                             scenario_config: Union[str, ScenarioConfig, List, None] = None,
-                            ) -> "GuiEventConsumer":
+                            ) -> "EventProcessor":
         """ Register a callback for scenario creation events.
 
-        !!! Example:
+        !!! example:
 
             === "A callback for all scenario creations"
 
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
 
             def print_scenario_created(event: Event, scenario: Scenario, gui: Gui):
                 print(f"Scenario '{scenario.name}' created at '{event.creation_date}'.")
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.on_scenario_created(callback=print_scenario_created)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.on_scenario_created(callback=print_scenario_created)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -340,15 +339,15 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui
+            from taipy import Event, EventProcessor, Gui
 
             def print_scenario_created(event: Event, scenario: Scenario, gui: Gui):
                 print(f"Scenario '{scenario.name}' created at '{event.creation_date}'.")
 
             if __name__ == "__main__":
-                event_consumer = GuiEventConsumer()
-                event_consumer.on_scenario_created(callback=print_scenario_created, scenario_config="my_cfg")
-                event_consumer.start()
+                event_processor = EventProcessor()
+                event_processor.on_scenario_created(callback=print_scenario_created, scenario_config="my_cfg")
+                event_processor.start()
                 ...
             ```
 
@@ -369,7 +368,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 for all scenario configurations.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_scenario_created(
             callback=callback,
@@ -382,16 +381,16 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                                       callback: Callable,
                                       callback_args: Optional[List] = None,
                                       scenario_config: Union[str, ScenarioConfig, List, None] = None,
-                                      ) -> "GuiEventConsumer":
+                                      ) -> "EventProcessor":
         """ Register a callback executed for all states on scenario creation events.
 
-        !!! Examples:
+        !!! example:
 
                 === "Two callbacks for all scenario creations"
 
                 ```python
                 import taipy as tp
-                from taipy import Event, GuiEventConsumer, Gui, State
+                from taipy import Event, EventProcessor, Gui, State
 
                 def store_latest_scenario(state: State, event: Event, scenario: Scenario):
                     print(f"Scenario '{scenario.name}' created at '{event.creation_date}'.")
@@ -399,9 +398,9 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
                 if __name__ == "__main__":
                     gui = Gui()
-                    event_consumer = GuiEventConsumer(gui)
-                    event_consumer.broadcast_on_scenario_created(callback=store_latest_scenario)
-                    event_consumer.start()
+                    event_processor = EventProcessor(gui)
+                    event_processor.broadcast_on_scenario_created(callback=store_latest_scenario)
+                    event_processor.start()
                     ...
                     taipy.run(gui)
                 ```
@@ -410,16 +409,16 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
                 ```python
                 import taipy as tp
-                from taipy import Event, GuiEventConsumer, Gui
+                from taipy import Event, EventProcessor, Gui
 
                 def scenario_created(state, event: Event, scenario: Scenario):
                     print(f"Scenario '{scenario.name}' created at '{event.creation_date}'.")
                     state.latest_scenario = scenario
 
                 if __name__ == "__main__":
-                    event_consumer = GuiEventConsumer()
-                    event_consumer.broadcast_on_scenario_created(callback=scenario_created, scenario_config="my_cfg")
-                    event_consumer.start()
+                    event_processor = EventProcessor()
+                    event_processor.broadcast_on_scenario_created(callback=scenario_created, scenario_config="my_cfg")
+                    event_processor.start()
                     ...
                 ```
 
@@ -441,7 +440,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 for all scenario configurations.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_scenario_created(
             callback=callback,
@@ -455,7 +454,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                               callback_args: Optional[List] = None,
                               scenario_config: Union[str, ScenarioConfig, List, None] = None,
                               broadcast: bool = False,
-                              ) -> "GuiEventConsumer":
+                              ) -> "EventProcessor":
         scenario_config = self.__format_configs_parameter(ScenarioConfig, scenario_config)
 
         def _filter(event: Event) -> bool:
@@ -483,24 +482,24 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                             callback: Callable,
                             callback_args: Optional[List] = None,
                             scenario_config: Union[str, ScenarioConfig, List, None] = None,
-                            ) -> "GuiEventConsumer":
+                            ) -> "EventProcessor":
         """ Register a callback for scenario deletion events.
 
-        !!! Example:
+        !!! example:
 
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
 
             def print_scenario_deleted(event: Event, scenario_id: str, gui: Gui):
                 print(f"A scenario has been deleted at '{event.creation_date}'.")
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.on_scenario_deleted(callback=print_scenario_)
-                event_consumer.on_scenario_deleted(callback=print_scenario_deleted)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.on_scenario_deleted(callback=print_scenario_)
+                event_processor.on_scenario_deleted(callback=print_scenario_deleted)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -522,7 +521,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 for all scenario configurations.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_scenario_deleted(
             callback=callback,
@@ -535,14 +534,14 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                                       callback: Callable,
                                       callback_args: Optional[List] = None,
                                       scenario_config: Union[str, ScenarioConfig, List, None] = None,
-                                      ) -> "GuiEventConsumer":
+                                      ) -> "EventProcessor":
         """ Register a callback executed for all states on scenario deletion events.
 
-        !!! Example:
+        !!! example:
 
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
             from taipy.gui import notify
 
             def on_scenario_deleted(state: State, event: Event, scenario_id: str):
@@ -550,9 +549,9 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.broadcast_on_scenario_deleted(callback=on_scenario_deleted)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.broadcast_on_scenario_deleted(callback=on_scenario_deleted)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -574,7 +573,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 for all scenario configurations.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_scenario_deleted(
             callback=callback,
@@ -588,7 +587,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                               callback_args: Optional[List] = None,
                               scenario_config: Union[str, ScenarioConfig, List, None] = None,
                               broadcast: bool = False
-                              ) -> "GuiEventConsumer":
+                              ) -> "EventProcessor":
         scenario_config = self.__format_configs_parameter(ScenarioConfig, scenario_config)
 
         def _filter(event: Event) -> bool:
@@ -613,26 +612,27 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                             callback: Callable,
                             callback_args: Optional[List] = None,
                             datanode_config: Union[str, DataNodeConfig, List, None] = None,
-                            ) -> "GuiEventConsumer":
+                            ) -> "EventProcessor":
         """ Register a callback for data node written events.
 
         The callback is triggered when a datanode is written (see methods
-        `Datanode.write()^` or `Datanode.append()^`).
+        `DataNode.write()^` or `DataNode.append()^`).
+
+        !!! example:
 
-        !!! Example:
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
 
-            def last_data_edition(event: Event, datanode: Datanode, data: Any, gui: Gui):
+            def last_data_edition(event: Event, datanode: DataNode, data: Any, gui: Gui):
                 print(f"Datanode written at '{event.creation_date}'.")
                 state.last_data_edition.append[datanode.id]
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.on_datanode_written(callback=last_data_edition, broadcast=True)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.on_datanode_written(callback=last_data_edition, broadcast=True)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -641,12 +641,12 @@ class GuiEventConsumer(_CoreEventConsumerBase):
             callback (callable):The callback to be executed when consuming the event.
                 ```python
                 def on_event_received(event: Event,
-                                      datanode: Datanode,
+                                      datanode: DataNode,
                                       data: Any,
                                       gui: Gui):
                     ...
                 ```
-               The callback takes the event, the datanode, the data, and the GUI instance as
+                The callback takes the event, the datanode, the data, and the GUI instance as
                 arguments. Optionally, the callback can accept extra arguments (see the
                 `callback_args` argument).
             callback_args (List[AnyOf]): The extra arguments to be passed to the callback
@@ -657,7 +657,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 for all datanode configurations.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_datanode_written(
             callback=callback,
@@ -670,26 +670,27 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                                       callback: Callable,
                                       callback_args: Optional[List] = None,
                                       datanode_config: Union[str, DataNodeConfig, List, None] = None,
-                                      ) -> "GuiEventConsumer":
+                                      ) -> "EventProcessor":
         """ Register a callback for data node written events.
 
         The callback is triggered when a datanode is written (see methods
-        `Datanode.write()^` or `Datanode.append()^`).
+        `DataNode.write()^` or `DataNode.append()^`).
+
+        !!! example:
 
-        !!! Example:
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
 
-            def last_data_edition(state: State, event: Event, datanode: Datanode, data: Any):
+            def last_data_edition(state: State, event: Event, datanode: DataNode, data: Any):
                 print(f"Datanode written at '{event.creation_date}'.")
                 state.last_data_edition.append[datanode.id]
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.broadcast_on_datanode_written(callback=last_data_edition)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.broadcast_on_datanode_written(callback=last_data_edition)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -698,10 +699,10 @@ class GuiEventConsumer(_CoreEventConsumerBase):
             callback (callable): The callback to be executed for all states on data node
                 written events.
                 ```python
-                def on_event_received(state: State, event: Event, datanode: Datanode, data: Any):
+                def on_event_received(state: State, event: Event, datanode: DataNode, data: Any):
                     ...
                 ```
-               The callback takes the state, the event, the datanode, the data, and the GUI
+                The callback takes the state, the event, the datanode, the data, and the GUI
                 instance as arguments. Optionally, the callback can accept extra arguments
                 (see the `callback_args` argument).
             callback_args (List[AnyOf]): The extra arguments to be passed to the callback
@@ -712,7 +713,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 for all datanode configurations.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_datanode_written(
             callback=callback,
@@ -726,7 +727,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                               callback_args: Optional[List] = None,
                               datanode_config: Union[str, DataNodeConfig, List, None] = None,
                               broadcast: bool = False
-                              ) -> "GuiEventConsumer":
+                              ) -> "EventProcessor":
         datanode_config = self.__format_configs_parameter(DataNodeConfig, datanode_config)
 
         def _filter(event: Event) -> bool:
@@ -756,22 +757,23 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                             callback: Callable,
                             callback_args: Optional[List] = None,
                             datanode_config: Union[str, DataNodeConfig, List, None] = None,
-                            ) -> "GuiEventConsumer":
+                            ) -> "EventProcessor":
         """ Register a callback for data node deletion events.
 
-        !!! Example:
+        !!! example:
+
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
 
             def on_deletions(event: Event, datanode_id: str, gui: Gui):
                 print(f"Datanode deleted at '{event.creation_date}'.")
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.on_datanode_deleted(callback=record_deletions)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.on_datanode_deleted(callback=record_deletions)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -793,7 +795,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 for all datanode configurations.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_datanode_deleted(
             callback=callback,
@@ -806,13 +808,14 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                                       callback: Callable,
                                       callback_args: Optional[List] = None,
                                       datanode_config: Union[str, DataNodeConfig, List, None] = None,
-                                      ) -> "GuiEventConsumer":
+                                      ) -> "EventProcessor":
         """ Register a callback for each state on data node deletion events.
 
-        !!! Example:
+        !!! example:
+
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
 
             def record_deletions(state: State, event: Event, datanode_id: str):
                 print(f"Datanode deleted at '{event.creation_date}'.")
@@ -820,9 +823,9 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.broadcast_on_datanode_deleted(callback=record_deletions)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.broadcast_on_datanode_deleted(callback=record_deletions)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -845,7 +848,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 for all datanode configurations.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_datanode_deleted(
             callback=callback,
@@ -859,7 +862,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                               callback_args: Optional[List] = None,
                               datanode_config: Union[str, DataNodeConfig, List, None] = None,
                               broadcast: bool = False
-                              ) -> "GuiEventConsumer":
+                              ) -> "EventProcessor":
         datanode_config = self.__format_configs_parameter(DataNodeConfig, datanode_config)
 
         def _filter(event: Event) -> bool:
@@ -884,22 +887,23 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                             callback: Callable,
                             callback_args: Optional[List] = None,
                             datanode_config: Union[str, DataNodeConfig, List, None] = None,
-                            ) -> "GuiEventConsumer":
+                            ) -> "EventProcessor":
         """ Register a callback to be executed on data node creation event.
 
-        !!! Example:
+        !!! example:
+
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
 
             def on_datanode_creations(event: Event, datanode: DataNode, gui: Gui):
                 print(f"Datanode created at '{event.creation_date}'.")
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.on_datanode_created(callback=record_creations)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.on_datanode_created(callback=record_creations)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -921,7 +925,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 for all datanode configurations.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_datanode_created(
             callback=callback,
@@ -934,13 +938,14 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                                       callback: Callable,
                                       callback_args: Optional[List] = None,
                                       datanode_config: Union[str, DataNodeConfig, List, None] = None,
-                                      ) -> "GuiEventConsumer":
+                                      ) -> "EventProcessor":
         """ Register a callback to be executed for each state on data node creation event.
 
-        !!! Examples:
+        !!! example:
+
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
             from taipy.gui import notify
 
             def on_datanode_creations(state: State, event: Event, datanode: DataNode):
@@ -949,9 +954,9 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.broadcast_on_datanode_created(callback=record_creations)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.broadcast_on_datanode_created(callback=record_creations)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -973,7 +978,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 for all datanode configurations.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_datanode_created(
             callback=callback,
@@ -987,7 +992,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                               callback_args: Optional[List] = None,
                               datanode_config: Union[str, DataNodeConfig, List, None] = None,
                               broadcast: bool = False
-                              ) -> "GuiEventConsumer":
+                              ) -> "EventProcessor":
         datanode_config = self.__format_configs_parameter(DataNodeConfig, datanode_config)
 
         def _filter(event: Event) -> bool:
@@ -1015,13 +1020,14 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                                callback: Callable,
                                callback_args: Optional[List] = None,
                                config_ids: Union[str, ScenarioConfig, TaskConfig, List, None] = None,
-                               ) -> "GuiEventConsumer":
+                               ) -> "EventProcessor":
         """Register a callback for submission finished events.
 
-        !!! Example:
+        !!! example:
+
             ```python
             import taipy as tp
-            from taipy import Event, GuiEventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
 
             def record_submissions(event: Event, submittable: Submittable, submission: Submission, gui: Gui):
                 if submission.submission_status == SubmissionStatus.COMPLETED:
@@ -1031,9 +1037,9 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.on_submission_finished(callback=record_submissions)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.on_submission_finished(callback=record_submissions)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -1056,7 +1062,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 If None, the callback is registered for any submittable.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_submission_finished(
             callback=callback,
@@ -1069,13 +1075,14 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                                          callback: Callable,
                                          callback_args: Optional[List] = None,
                                          config_ids: Union[str, ScenarioConfig, TaskConfig, List, None] = None,
-                                         ) -> "GuiEventConsumer":
+                                         ) -> "EventProcessor":
         """Register a callback to be executed for each state on submission finished events.
 
-        !!! Example:
+        !!! example
+:
             ```python
             import taipy as tp
-            from taipy import Event, EventConsumer, Gui, State
+            from taipy import Event, EventProcessor, Gui, State
 
             def record_submissions(state: State, event: Event, submittable: Submittable, submission: Submission):
                 print(f"Submission finished at '{event.creation_date}'. Status: '{submission.submission_status}'")
@@ -1086,9 +1093,9 @@ class GuiEventConsumer(_CoreEventConsumerBase):
 
             if __name__ == "__main__":
                 gui = Gui()
-                event_consumer = GuiEventConsumer(gui)
-                event_consumer.on_submission_finished(callback=record_submissions, broadcast=True)
-                event_consumer.start()
+                event_processor = EventProcessor(gui)
+                event_processor.on_submission_finished(callback=record_submissions, broadcast=True)
+                event_processor.start()
                 ...
                 taipy.run(gui)
             ```
@@ -1112,7 +1119,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                 If None, the callback is registered for any submittable.
 
         Returns:
-            GuiEventConsumer: The current instance of the `GuiEventConsumer` service.
+            EventProcessor: The current instance of the `EventProcessor` service.
         """
         return self.__on_submission_finished(
             callback=callback,
@@ -1126,7 +1133,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
                                  callback_args: Optional[List] = None,
                                  config_ids: Union[str, ScenarioConfig, TaskConfig, List, None] = None,
                                  broadcast: bool = False
-                                 ) -> "GuiEventConsumer":
+                                 ) -> "EventProcessor":
         if isinstance(config_ids, str):
             config_ids = [config_ids]
         if isinstance(config_ids, TaskConfig):
@@ -1186,12 +1193,12 @@ class GuiEventConsumer(_CoreEventConsumerBase):
         self.event_processor.process_event(self, event)
 
     def start(self):
-        """Start the event consumer thread."""
+        """Start the event processor thread."""
         Notifier._register_from_registration(self._registration)
         super().start()
 
     def stop(self):
-        """Stop the event consumer thread."""
+        """Stop the event processor thread."""
         super().stop()
         Notifier.unregister(self._registration.registration_id)
 
@@ -1219,9 +1226,9 @@ class GuiEventConsumer(_CoreEventConsumerBase):
         if broadcast and self._gui is None:
             _TaipyLogger._get_logger().error(
                 "A callback is set to be broadcast to all states of "
-                "the GUI but no GUI is provided to the event consumer."
+                "the GUI but no GUI is provided to the event processor."
             )
-            raise NoGuiDefinedInEventConsumer()
+            raise NoGuiDefinedInEventProcessor()
         if callback_args is None:
             callback_args = []
         cb = _Callback(callback, args=callback_args, broadcast=broadcast, filter=filter)
@@ -1245,7 +1252,7 @@ class GuiEventConsumer(_CoreEventConsumerBase):
             if not self._gui:
                 _TaipyLogger._get_logger().error(
                     "A callback is set to be broadcast to all states of "
-                    "the GUI but no GUI is provided to the event consumer."
+                    "the GUI but no GUI is provided to the event processor."
                 )
                 return
             self._gui.broadcast_callback(cb.callback, [event, *predefined_args, *cb.args])

+ 13 - 0
taipy/event/exceptions/__init__.py

@@ -0,0 +1,13 @@
+# Copyright 2021-2025 Avaiga Private Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+# an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations under the License.
+
+"""Exceptions raised by `taipy.event` package functionalities."""
+from .exceptions import *

+ 1 - 3
taipy/exceptions/__init__.py → taipy/event/exceptions/exceptions.py

@@ -9,8 +9,6 @@
 # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 # specific language governing permissions and limitations under the License.
 
-"""Exceptions raised by taipy package functionalities."""
-
-class NoGuiDefinedInEventConsumer(Exception):
+class NoGuiDefinedInEventProcessor(Exception):
     """Raised when an on event callback is registered to be broadcast to all states,
     but no GUI is defined in the event consumer."""

+ 13 - 13
tests/event/test_consumer__on_datanode_created.py

@@ -14,7 +14,7 @@ from unittest.mock import ANY
 from taipy import DataNode, Gui
 from taipy.core.config import DataNodeConfig
 from taipy.core.notification import Event, EventEntityType, EventOperation
-from taipy.event.event_consumer import GuiEventConsumer
+from taipy.event.event_processor import EventProcessor
 
 
 def cb_0(event: Event, datanode: DataNode):
@@ -30,8 +30,8 @@ def cb_for_state(state, event: Event, datanode: DataNode):
 
 
 def test_on_datanode_created(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_created(callback=cb_0)
         # test the on_datanode_created method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_0,
@@ -54,8 +54,8 @@ def test_on_datanode_created(data_node):
 
 
 def test_on_datanode_created_multiple_configs(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_created(callback=cb_0,
                                      datanode_config=[DataNodeConfig("dn0"), "dn1", DataNodeConfig("dn2"), "data_node"])
         # test the on_datanode_created method delegates to on_event with the correct parameters
@@ -79,8 +79,8 @@ def test_on_datanode_created_multiple_configs(data_node):
 
 
 def test_on_datanode_created_multiple_configs_no_matching(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_created(callback=cb_0,
                                      datanode_config=[DataNodeConfig("dn0"), "dn1"])
         # test the on_datanode_created method delegates to on_event with the correct parameters
@@ -105,8 +105,8 @@ def test_on_datanode_created_multiple_configs_no_matching(data_node):
 
 
 def test_on_datanode_created_with_args_and_matching_config(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_created(callback=cb_1, callback_args=["foo"], datanode_config="data_node")
         # test the on_datanode_created method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_1,
@@ -129,8 +129,8 @@ def test_on_datanode_created_with_args_and_matching_config(data_node):
 
 
 def test_on_datanode_created_with_args_and_not_matching_config(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_created(callback=cb_1, callback_args=["foo"], datanode_config="WRONG_CFG")
         # test the on_datanode_created method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_1,
@@ -153,8 +153,8 @@ def test_on_datanode_created_with_args_and_not_matching_config(data_node):
 
 
 def test_on_datanode_created_with_broadcast():
-    consumer = GuiEventConsumer(Gui())
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor(Gui())
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.broadcast_on_datanode_created(callback=cb_for_state)
         mck.assert_called_once_with(callback=cb_for_state,
                                     callback_args=None,

+ 13 - 13
tests/event/test_consumer__on_datanode_deleted.py

@@ -14,7 +14,7 @@ from unittest.mock import ANY
 from taipy import Gui
 from taipy.core.config import DataNodeConfig
 from taipy.core.notification import Event, EventEntityType, EventOperation
-from taipy.event.event_consumer import GuiEventConsumer
+from taipy.event.event_processor import EventProcessor
 
 
 def cb_0(event: Event, datanode: str):
@@ -30,8 +30,8 @@ def cb_for_state(state, event: Event, datanode: str):
 
 
 def test_on_datanode_deleted(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_deleted(callback=cb_0)
         # test the on_datanode_deleted method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_0,
@@ -51,8 +51,8 @@ def test_on_datanode_deleted(data_node):
 
 
 def test_on_datanode_deleted_multiple_configs(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_deleted(callback=cb_0,
                                      datanode_config=[DataNodeConfig("dn0"), "dn1", DataNodeConfig("dn2"), "data_node"])
         # test the on_datanode_deleted method delegates to on_event with the correct parameters
@@ -73,8 +73,8 @@ def test_on_datanode_deleted_multiple_configs(data_node):
 
 
 def test_on_datanode_deleted_multiple_configs_no_matching(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_deleted(callback=cb_0,
                                      datanode_config=[DataNodeConfig("dn0"), "dn1"])
         # test the on_datanode_deleted method delegates to on_event with the correct parameters
@@ -96,8 +96,8 @@ def test_on_datanode_deleted_multiple_configs_no_matching(data_node):
 
 
 def test_on_datanode_deleted_with_args_and_matching_config(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_deleted(callback=cb_1, callback_args=["foo"], datanode_config="data_node")
         # test the on_datanode_deleted method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_1,
@@ -117,8 +117,8 @@ def test_on_datanode_deleted_with_args_and_matching_config(data_node):
 
 
 def test_on_datanode_deleted_with_args_and_not_matching_config(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_deleted(callback=cb_1, callback_args=["foo"], datanode_config="WRONG_CFG")
         # test the on_datanode_deleted method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_1,
@@ -138,8 +138,8 @@ def test_on_datanode_deleted_with_args_and_not_matching_config(data_node):
 
 
 def test_on_datanode_deleted_with_broadcast(data_node):
-    consumer = GuiEventConsumer(Gui())
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor(Gui())
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.broadcast_on_datanode_deleted(callback=cb_for_state)
         mck.assert_called_once_with(callback=cb_for_state,
                                     callback_args=None,

+ 13 - 13
tests/event/test_consumer__on_datanode_written.py

@@ -15,7 +15,7 @@ from unittest.mock import ANY
 from taipy import DataNode, Gui
 from taipy.core.config import DataNodeConfig
 from taipy.core.notification import Event, EventEntityType, EventOperation
-from taipy.event.event_consumer import GuiEventConsumer
+from taipy.event.event_processor import EventProcessor
 
 
 def cb_0(event: Event, datanode: DataNode, data: Any):
@@ -31,8 +31,8 @@ def cb_for_state(state, event: Event, datanode: DataNode, data: Any):
 
 
 def test_on_datanode_written(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_written(callback=cb_0)
         # test the on_datanode_written method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_0,
@@ -59,8 +59,8 @@ def test_on_datanode_written(data_node):
 
 
 def test_on_datanode_written_multiple_configs(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_written(callback=cb_0,
                                      datanode_config=[DataNodeConfig("dn0"), "dn1", DataNodeConfig("dn2"), "data_node"])
         # test the on_datanode_written method delegates to on_event with the correct parameters
@@ -88,8 +88,8 @@ def test_on_datanode_written_multiple_configs(data_node):
 
 
 def test_on_datanode_written_multiple_configs_no_matching(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_written(callback=cb_0,
                                      datanode_config=[DataNodeConfig("dn0"), "dn1"])
         # test the on_datanode_written method delegates to on_event with the correct parameters
@@ -117,8 +117,8 @@ def test_on_datanode_written_multiple_configs_no_matching(data_node):
 
 
 def test_on_datanode_written_with_args_and_matching_config(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_written(callback=cb_1, callback_args=["foo"], datanode_config="data_node")
         # test the on_datanode_written method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_1,
@@ -145,8 +145,8 @@ def test_on_datanode_written_with_args_and_matching_config(data_node):
 
 
 def test_on_datanode_written_with_args_and_not_matching_config(data_node):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_datanode_written(callback=cb_1, callback_args=["foo"], datanode_config="WRONG_CFG")
         # test the on_datanode_written method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_1,
@@ -173,8 +173,8 @@ def test_on_datanode_written_with_args_and_not_matching_config(data_node):
 
 
 def test_on_datanode_written_with_broadcast(data_node):
-    consumer = GuiEventConsumer(Gui())
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor(Gui())
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.broadcast_on_datanode_written(callback=cb_for_state)
         mck.assert_called_once_with(callback=cb_for_state,
                                     callback_args=None,

+ 6 - 6
tests/event/test_consumer__on_event.py

@@ -14,8 +14,8 @@ import pytest
 from taipy import Gui
 from taipy.core.notification import Event, EventEntityType, EventOperation, _Topic
 from taipy.event._event_callback import _Callback
-from taipy.event.event_consumer import GuiEventConsumer
-from taipy.exceptions import NoGuiDefinedInEventConsumer
+from taipy.event.event_processor import EventProcessor
+from taipy.event.exceptions.exceptions import NoGuiDefinedInEventProcessor
 
 
 def cb_0(event: Event, extra:str):
@@ -35,7 +35,7 @@ def cb_for_state(state, event: Event):
 
 
 def test_on_event():
-    consumer = GuiEventConsumer()
+    consumer = EventProcessor()
     consumer.on_event(callback=cb_0, callback_args=["foo"])
     consumer.on_event(callback=cb_1, entity_type=EventEntityType.SCENARIO)
     consumer.on_event(callback=cb_2, entity_type=EventEntityType.SCENARIO, entity_id="bar")
@@ -76,7 +76,7 @@ def test_on_event():
 
 
 def test_on_event_for_state():
-    consumer = GuiEventConsumer(gui=Gui())
+    consumer = EventProcessor(gui=Gui())
     consumer.broadcast_on_event(callback=cb_for_state)
 
     assert consumer._gui is not None
@@ -87,7 +87,7 @@ def test_on_event_for_state():
 
 
 def test_on_event_missing_gui():
-    consumer = GuiEventConsumer()
-    with pytest.raises(NoGuiDefinedInEventConsumer):
+    consumer = EventProcessor()
+    with pytest.raises(NoGuiDefinedInEventProcessor):
         consumer.broadcast_on_event(callback=cb_for_state)
     assert len(consumer._topic_callbacks_map) == 0

+ 13 - 13
tests/event/test_consumer__on_scenario_created.py

@@ -14,7 +14,7 @@ from unittest.mock import ANY
 from taipy import Gui, Scenario
 from taipy.core.config import ScenarioConfig
 from taipy.core.notification import Event, EventEntityType, EventOperation
-from taipy.event.event_consumer import GuiEventConsumer
+from taipy.event.event_processor import EventProcessor
 
 
 def cb_0(event: Event, scenario: Scenario):
@@ -30,8 +30,8 @@ def cb_for_state(state, event: Event, scenario: Scenario):
 
 
 def test_on_scenario_created(scenario):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_scenario_created(callback=cb_0)
         # test the on_scenario_created method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_0,
@@ -54,8 +54,8 @@ def test_on_scenario_created(scenario):
 
 
 def test_on_scenario_created_multiple_configs(scenario):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_scenario_created(callback=cb_0,
                                      scenario_config=[ScenarioConfig("sc_0"), "sc_1", ScenarioConfig("sc_2"), "sc"])
         # test the on_scenario_created method delegates to on_event with the correct parameters
@@ -79,8 +79,8 @@ def test_on_scenario_created_multiple_configs(scenario):
 
 
 def test_on_scenario_created_multiple_configs_no_matching(scenario):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_scenario_created(callback=cb_0,
                                      scenario_config=[ScenarioConfig("sc_0"), "sc_1"])
         # test the on_scenario_created method delegates to on_event with the correct parameters
@@ -105,8 +105,8 @@ def test_on_scenario_created_multiple_configs_no_matching(scenario):
 
 
 def test_on_scenario_created_with_args_and_matching_config(scenario):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_scenario_created(callback=cb_1, callback_args=["foo"], scenario_config="sc")
         # test the on_scenario_created method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_1,
@@ -129,8 +129,8 @@ def test_on_scenario_created_with_args_and_matching_config(scenario):
 
 
 def test_on_scenario_created_with_args_and_not_matching_config(scenario):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_scenario_created(callback=cb_1, callback_args=["foo"], scenario_config="WRONG_CFG")
         # test the on_scenario_created method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_1,
@@ -153,8 +153,8 @@ def test_on_scenario_created_with_args_and_not_matching_config(scenario):
 
 
 def test_on_scenario_created_with_broadcast():
-    consumer = GuiEventConsumer(Gui())
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor(Gui())
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.broadcast_on_scenario_created(callback=cb_for_state)
         mck.assert_called_once_with(callback=cb_for_state,
                                     callback_args=None,

+ 13 - 13
tests/event/test_consumer__on_scenario_deleted.py

@@ -14,7 +14,7 @@ from unittest.mock import ANY
 from taipy import Gui
 from taipy.core.config import ScenarioConfig
 from taipy.core.notification import Event, EventEntityType, EventOperation
-from taipy.event.event_consumer import GuiEventConsumer
+from taipy.event.event_processor import EventProcessor
 
 
 def cb_0(event: Event, scenario: str):
@@ -30,8 +30,8 @@ def cb_for_state(state, event: Event, scenario: str):
 
 
 def test_on_scenario_deleted(scenario):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_scenario_deleted(callback=cb_0)
         # test the on_scenario_deleted method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_0,
@@ -51,8 +51,8 @@ def test_on_scenario_deleted(scenario):
 
 
 def test_on_scenario_deleted_multiple_configs(scenario):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_scenario_deleted(callback=cb_0,
                                      scenario_config=[ScenarioConfig("sc_0"), "sc_1", ScenarioConfig("sc_2"), "sc"])
         # test the on_scenario_deleted method delegates to on_event with the correct parameters
@@ -73,8 +73,8 @@ def test_on_scenario_deleted_multiple_configs(scenario):
 
 
 def test_on_scenario_deleted_multiple_configs_no_matching(scenario):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_scenario_deleted(callback=cb_0,
                                      scenario_config=[ScenarioConfig("sc_0"), "sc_1"])
         # test the on_scenario_deleted method delegates to on_event with the correct parameters
@@ -96,8 +96,8 @@ def test_on_scenario_deleted_multiple_configs_no_matching(scenario):
 
 
 def test_on_scenario_deleted_with_args_and_matching_config(scenario):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_scenario_deleted(callback=cb_1, callback_args=["foo"], scenario_config="sc")
         # test the on_scenario_deleted method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_1,
@@ -117,8 +117,8 @@ def test_on_scenario_deleted_with_args_and_matching_config(scenario):
 
 
 def test_on_scenario_deleted_with_args_and_not_matching_config(scenario):
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_scenario_deleted(callback=cb_1, callback_args=["foo"], scenario_config="WRONG_CFG")
         # test the on_scenario_deleted method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_1,
@@ -138,8 +138,8 @@ def test_on_scenario_deleted_with_args_and_not_matching_config(scenario):
 
 
 def test_on_scenario_deleted_with_broadcast(scenario):
-    consumer = GuiEventConsumer(Gui())
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor(Gui())
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.broadcast_on_scenario_deleted(callback=cb_for_state)
         mck.assert_called_once_with(callback=cb_for_state,
                                     callback_args=None,

+ 17 - 17
tests/event/test_consumer__on_submission_finished.py

@@ -13,7 +13,7 @@ from unittest.mock import ANY
 
 from taipy import Gui, Scenario, Submission, SubmissionStatus
 from taipy.core.notification import Event, EventEntityType, EventOperation
-from taipy.event.event_consumer import GuiEventConsumer
+from taipy.event.event_processor import EventProcessor
 
 
 def cb_0(event: Event, submittable: Scenario, submission: Submission):
@@ -30,8 +30,8 @@ def cb_for_state(state, event: Event, submittable: Scenario, submission: Submiss
 
 def test_on_scenario_submission_finished(scenario, submission):
     submission._entity_id = scenario.id
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_submission_finished(callback=cb_0)
         # test the on_submission_finished method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_0,
@@ -87,8 +87,8 @@ def test_on_scenario_submission_finished(scenario, submission):
 
 def test_filter_false__wrong_status(scenario, submission):
     submission._entity_id = scenario.id
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_submission_finished(callback=cb_0)
         # test the on_submission_finished method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_0,
@@ -127,8 +127,8 @@ def test_filter_false__wrong_status(scenario, submission):
 
 def test_filter_false__config_ids_and_sequence(scenario, sequence, submission):
     submission._entity_id = sequence.id
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_submission_finished(callback=cb_0, config_ids=scenario.config_id)
         # test the on_submission_finished method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_0,
@@ -160,8 +160,8 @@ def test_filter_false__config_ids_and_sequence(scenario, sequence, submission):
 def test_filter_false__not_matching_config_ids(scenario, submission):
     submission._entity_id = scenario.id
     submission._entity_config_id = scenario.config_id
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_submission_finished(callback=cb_0, config_ids=["NOT_MATCHING_CONFIG_ID"])
         # test the on_submission_finished method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_0,
@@ -194,8 +194,8 @@ def test_filter_false__not_matching_config_ids(scenario, submission):
 def test_filter_true__with_config(scenario, submission):
     submission._entity_id = scenario.id
     submission._entity_config_id = scenario.config_id
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_submission_finished(callback=cb_0, config_ids=["scenario_cfg", scenario.config_id])
         # test the on_submission_finished method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_0,
@@ -226,8 +226,8 @@ def test_filter_true__with_config(scenario, submission):
 
 def test_filter_true__without_config(scenario, submission):
     submission._entity_id = scenario.id
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_submission_finished(callback=cb_0)
         # test the on_submission_finished method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_0,
@@ -257,8 +257,8 @@ def test_filter_true__without_config(scenario, submission):
 
 
 def test_on_scenario_submission_finished_with_args():
-    consumer = GuiEventConsumer()
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor()
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.on_submission_finished(callback=cb_1, callback_args=["extra"])
         # test the on_submission_finished method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_1,
@@ -271,8 +271,8 @@ def test_on_scenario_submission_finished_with_args():
 
 
 def test_on_scenario_submission_finished_with_args_and_state():
-    consumer = GuiEventConsumer(gui=Gui())
-    with mock.patch("taipy.event.event_consumer.GuiEventConsumer._GuiEventConsumer__on_event") as mck:
+    consumer = EventProcessor(gui=Gui())
+    with mock.patch("taipy.event.event_processor.EventProcessor._EventProcessor__on_event") as mck:
         consumer.broadcast_on_submission_finished(callback=cb_for_state, callback_args=["extra"])
         # test the on_submission_finished method delegates to on_event with the correct parameters
         mck.assert_called_once_with(callback=cb_for_state,

+ 6 - 6
tests/event/test_consumer__process_event.py

@@ -14,7 +14,7 @@ from unittest import mock
 from taipy import Gui, Scenario
 from taipy.core.notification import Event, EventEntityType, EventOperation, _Topic
 from taipy.event._event_callback import _Callback
-from taipy.event.event_consumer import GuiEventConsumer
+from taipy.event.event_processor import EventProcessor
 
 collector: Dict[str, Any] = {"cb_0": 0, "cb_1": 0, "cb_2": 0, "cb_3": 0, "cb_for_state": 0,
             "cb_scenario_creation": 0, "cb_scenario_creation_with_state": 0}
@@ -69,7 +69,7 @@ def cb_scenario_creation_with_state(state, event: Event, scenario: Scenario, ext
 def test_process_event(scenario):
     global collector
     global args_collector
-    consumer = GuiEventConsumer()
+    consumer = EventProcessor()
     consumer.on_event(callback=cb_0, callback_args=["foo"])
     consumer.on_event(callback=cb_1, entity_type=EventEntityType.SCENARIO)
     consumer.on_event(callback=cb_2, entity_type=EventEntityType.SCENARIO, entity_id="bar")
@@ -131,7 +131,7 @@ def test_process_event(scenario):
 
 
 def test_process_event_with_state():
-    consumer = GuiEventConsumer(gui=Gui())
+    consumer = EventProcessor(gui=Gui())
     consumer.broadcast_on_event(callback=cb_for_state)
 
     event_1 = Event(
@@ -153,7 +153,7 @@ def test_process_event_with_filter():
     def filt(event: Event) -> bool:
         return event.metadata.get("foo") == "bar"
 
-    consumer = GuiEventConsumer()
+    consumer = EventProcessor()
     consumer.on_event(callback=cb_0,
                       callback_args=["foo"],
                       entity_type=EventEntityType.SCENARIO,
@@ -189,7 +189,7 @@ def test_process_event_with_filter():
 def test_process_event_with_predefined_args(scenario):
     global collector
     global args_collector
-    consumer = GuiEventConsumer()
+    consumer = EventProcessor()
     consumer.on_event(callback=cb_scenario_creation, callback_args=["foo"])
     collector, args_collector = init_collector()
     event = Event(
@@ -207,7 +207,7 @@ def test_process_event_with_predefined_args(scenario):
 
 
 def test_process_event_with_predefined_args_and_state(scenario):
-    consumer = GuiEventConsumer(Gui())
+    consumer = EventProcessor(Gui())
     consumer.broadcast_on_event(callback=cb_scenario_creation_with_state, callback_args=["foo"])
     event = Event(
         entity_type=EventEntityType.SCENARIO,