elsa-core/src/common/Elsa.Mediator/Middleware/Notification
Sipke Schoorstra fc5612687d
Refactors notification system for context (#6821)
* Fix `CancellationToken` usage in `BackgroundCommandSenderHostedService`

Corrected the `CancellationToken` parameter to use `commandContext.CancellationToken` instead of the method's cancellation token, ensuring proper propagation and handling within the command sender.

Fixes #6449

* Refactor notifications system to use `NotificationContext` across channels and middleware

* Update src/common/Elsa.Mediator/Extensions/HandlerExtensions.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Simplify `InvokeAsync` method call by replacing braces with brackets in argument array.

* Refactor `NotificationContext` usage in mediator strategies and handler extensions

Replaced direct references to `Notification` and `CancellationToken` with `NotificationContext` across mediator strategies to align with updated context structure. Simplified handler invocations by passing `CommandContext` and `NotificationContext` where applicable.

* Refactor notification extraction in publishing strategies

Standardize notification retrieval by introducing `notificationContext.Notification` in `SequentialProcessingStrategy` and `ParallelProcessingStrategy` for improved clarity and consistency.

* Refactor hosted services to improve worker channel management and cancellation handling

Implemented better round-robin distribution and added linked cancellation token sources in `BackgroundCommandSender`, `JobRunner`, and `BackgroundEventPublisher` hosted services. Enhanced logging and comments for clarity.

* Update src/common/Elsa.Mediator/HostedServices/BackgroundCommandSenderHostedService.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-05 22:22:13 +02:00
..
Components Refactors notification system for context (#6821) 2025-08-05 22:22:13 +02:00
Contracts Make Mediator package reusable from outside Elsa feature system 2023-07-17 21:43:35 +02:00
MiddlewareExtensions.cs Enhances Mediator with Tenant Context Propagation (#6738) 2025-06-13 14:26:51 +02:00
NotificationContext.cs Enhances Mediator with Tenant Context Propagation (#6738) 2025-06-13 14:26:51 +02:00
NotificationMiddlewareDelegate.cs Make Mediator package reusable from outside Elsa feature system 2023-07-17 21:43:35 +02:00
NotificationPipeline.cs Make Mediator package reusable from outside Elsa feature system 2023-07-17 21:43:35 +02:00
NotificationPipelineBuilder.cs Fixing some analyzer warnings (#5617) 2024-07-05 15:14:28 +02:00
NotificationPipelineBuilderExtensions.cs Make Mediator package reusable from outside Elsa feature system 2023-07-17 21:43:35 +02:00