Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Remove duplicate text
  • Loading branch information
jrobinAV authored Sep 11, 2024
1 parent ce6ed72 commit a5c8e0a
Showing 1 changed file with 7 additions and 64 deletions.
71 changes: 7 additions & 64 deletions docs/userman/scenario_features/events/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +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 example demonstrates the power of event-driven programming in real-world applications. By capturing and processing events, developers can build responsive, dynamic systems that notify users of important changes (such as new scenario creations or data node updates) as they happen. This approach significantly enhances the user experience by providing real-time updates and ensuring users are always informed through an interactive and engaging interface.

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
and if the action is `CREATION^` or `UPDATE^`.
and if the action is `CREATION` or `UPDATE`.

!!! example
```python linenums="1"
Expand All @@ -21,17 +17,13 @@ and if the action is `CREATION^` or `UPDATE^`.
%}
```

This snippet shows a how you can capture and process events to notify user whenever
a new scenario is created or the value of a data node is updated.
This snippet shows how you can capture and process events to notify users whenever
a new scenario is created, or a data node's value is updated.
For more details, see the [registration](understanding-topics.md) page.

# 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 example illustrates leveraging event-driven programming to monitor and respond to specific event types. By implementing a custom event consumer, `JobFailureCoreConsumer`, developers can easily trigger external API calls based on specific job status updates. This approach ensures that critical job status changes are promptly communicated to external systems, enhancing the application's monitoring and integration with third-party systems.

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`,
Expand All @@ -45,56 +37,7 @@ and triggers an external API call based on the `JOB^`'s `id`.
%}
```

This snippet shows a how you can capture and process `JOB^` events when an `UPDATE` is made to the `status`
of the `JOB^` and request an external API.
This snippet shows how you can capture and process `JOB` events when an `UPDATE` is made to the `status`
of the `JOB` and request an external API.
For more details, see the [registration](understanding-topics.md) page.
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
and if the action is `CREATION^` or `UPDATE^`.

!!! example
```python linenums="1"
{%
include-markdown "./code-example/user-changes-notifier.py"
comments=false
%}
```

This snippet shows a how you can capture and process events to notify user whenever
a new scenario is created or the value of a data node is updated.
For more details, see the [registration](understanding-topics.md) page.

# 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`.

!!! example
```python linenums="1"
{%
include-markdown "./code-example/external-api-call-notifier.py"
comments=false
%}
```

This snippet shows a how you can capture and process `JOB^` events when an `UPDATE` is made to the `status`
of the `JOB^` and request an external API.
For more details, see the [registration](understanding-topics.md) page.

0 comments on commit a5c8e0a

Please sign in to comment.