Notifier class
A class for managing event registrations and publishing a Taipy application events.
Methods¶
publish()
classmethod
¶
publish(event: Event) -> None
register()
classmethod
¶
register(
entity_type: Optional[EventEntityType] = None,
entity_id: Optional[str] = None,
operation: Optional[EventOperation] = None,
attribute_name: Optional[str] = None,
) -> Tuple[str, SimpleQueue]
Register a listener for a specific event topic.
The topic is defined by the combination of an optional entity type, an optional entity id, an optional operation, and an optional attribute name. The purpose is to be as flexible as possible. For example, we can register to:
- All scenario creations
- A specific data node update
- A sequence submission
- A Scenario deletion
- Job failures
Standard usage
registration_id, registered_queue = Notifier.register(
entity_type=EventEntityType.SCENARIO,
operation=EventOperation.CREATION
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Optional[EventEntityType]
|
If provided, the listener will
be notified for all events related to this entity type. Otherwise,
the listener will be notified for events related to all entity types.
|
None
|
|
Optional[str]
|
If provided, the listener will be notified for all events related to this entity. Otherwise, the listener will be notified for events related to all entities. |
None
|
|
Optional[EventOperation]
|
If provided, the listener will
be notified for all events related to this operation. Otherwise,
the listener will be notified for events related to all operations.
|
None
|
|
Optional[str]
|
If provided, the listener will be notified for all events related to this entity's attribute. Otherwise, the listener will be notified for events related to all attributes. |
None
|
Returns:
Type | Description |
---|---|
Tuple[str, SimpleQueue]
|
A tuple containing the registration id and the event queue. |
unregister()
classmethod
¶
unregister(registration_id: str) -> None
Unregister a listener.
Standard usage
registration_id, registered_queue = Notifier.register(
entity_type=EventEntityType.CYCLE,
entity_id="CYCLE_cycle_1",
operation=EventOperation.CREATION
)
Notifier.unregister(registration_id)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
`RegistrationId`
|
The registration id returned by the |
required |