Skip to content

Commit

Permalink
added example motivation
Browse files Browse the repository at this point in the history
  • Loading branch information
Toan Quach authored and Toan Quach committed Sep 11, 2024
1 parent c0521ce commit bdb8eb2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ repos:
- id: black
args: [--line-length=120]
language_version: python3.9
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
additional_dependencies: [flake8-typing-imports==1.10.0]
# - repo: https://gitlab.com/pycqa/flake8
# rev: 3.9.2
# hooks:
# - id: flake8
# additional_dependencies: [flake8-typing-imports==1.10.0]
12 changes: 12 additions & 0 deletions docs/manuals/userman/sdm/events/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ Examples of using Taipy event notifications to capture and consume *events*.

# Real-Time GUI Updates with Taipy Event Consumers

This example is provided to demonstrate the practical application of event-driven programming in
a real-world scenario. By capturing and processing events, developers can create responsive and
dynamic systems that notify users of important changes, such as the creation of new scenarios or
updates to data nodes. This approach enhances user experience by ensuring that users are always
informed of relevant updates in real-time.

This script defines a custom event consumer class `SpecificCoreConsumer`, which listens
for all events published by Taipy Core and triggers GUI notification based on those events.
It includes determining if the event is published from a `Scenario^` entity or `DataNode^` entity
Expand All @@ -21,6 +27,12 @@ and if the action is `CREATION^` or `UPDATE^`.

# External API triggered with Taipy Event Consumers

This example illustrates how to effectively utilize event-driven programming to monitor and
respond to changes of specific event type within Taipy Core. By defining a custom event consumer,
`JobFailureCoreConsumer`, developers can seamlessly integrate external API calls triggered
by specific job status updates. This approach ensures that critical job status changes are promptly
communicated to external systems, enhancing the robustness and responsiveness of the application.

This script defines a custom event consumer class `JobFailureCoreConsumer`, which listens
for all events published by Taipy Core, when a `JOB^` entity's `status` attribute is `UPDATE`,
and triggers an external API call based on the `JOB^`'s `id`.
Expand Down

0 comments on commit bdb8eb2

Please sign in to comment.