| | | 1 | | using Elsa.Mediator.Contracts; |
| | | 2 | | using Elsa.Workflows.Runtime.Notifications; |
| | | 3 | | using JetBrains.Annotations; |
| | | 4 | | |
| | | 5 | | namespace Elsa.Http.Handlers; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// A handler that updates the route table when workflow triggers and bookmarks are indexed. |
| | | 9 | | /// </summary> |
| | | 10 | | [UsedImplicitly] |
| | 323 | 11 | | public class UpdateRouteTable(IRouteTableUpdater routeTableUpdater) : |
| | | 12 | | INotificationHandler<WorkflowTriggersIndexed>, |
| | | 13 | | INotificationHandler<WorkflowBookmarksIndexed> |
| | | 14 | | { |
| | | 15 | | /// <inheritdoc /> |
| | | 16 | | public async Task HandleAsync(WorkflowTriggersIndexed notification, CancellationToken cancellationToken) |
| | | 17 | | { |
| | 492 | 18 | | routeTableUpdater.RemoveRoutes(notification.IndexedWorkflowTriggers.RemovedTriggers); |
| | 492 | 19 | | await routeTableUpdater.AddRoutesAsync(notification.IndexedWorkflowTriggers.AddedTriggers, cancellationToken); |
| | 492 | 20 | | await routeTableUpdater.AddRoutesAsync(notification.IndexedWorkflowTriggers.UnchangedTriggers, cancellationToken |
| | 492 | 21 | | } |
| | | 22 | | |
| | | 23 | | /// <inheritdoc /> |
| | | 24 | | public async Task HandleAsync(WorkflowBookmarksIndexed notification, CancellationToken cancellationToken) |
| | | 25 | | { |
| | 325 | 26 | | routeTableUpdater.RemoveRoutes(notification.IndexedWorkflowBookmarks.RemovedBookmarks); |
| | 325 | 27 | | await routeTableUpdater.AddRoutesAsync(notification.IndexedWorkflowBookmarks.AddedBookmarks, notification.Indexe |
| | 325 | 28 | | } |
| | | 29 | | } |