-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Subscription Trigger notification handler + cleanup subscriptions (…
…#323) Co-authored-by: Louis-Axel Ambroise <ambroise.la@gmail.com>
- Loading branch information
1 parent
0c1053a
commit e82fdbc
Showing
6 changed files
with
32 additions
and
9 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/FasTnT.Domain/Messaging/Notifications/TriggerSubscriptionNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/FasTnT.Subscriptions/Handlers/SubscriptionTriggerHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using FasTnT.Domain.Notifications; | ||
using MediatR; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace FasTnT.Subscriptions.Handlers | ||
{ | ||
public class SubscriptionTriggerHandler : INotificationHandler<TriggerSubscriptionNotification> | ||
{ | ||
private readonly SubscriptionBackgroundService _service; | ||
|
||
public SubscriptionTriggerHandler(SubscriptionBackgroundService service) | ||
{ | ||
_service = service; | ||
} | ||
|
||
public Task Handle(TriggerSubscriptionNotification notification, CancellationToken cancellationToken) | ||
{ | ||
_service.Trigger(notification.Name); | ||
|
||
return Task.CompletedTask; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
test/FasTnT.UnitTest/Controllers/WhenSendingACustomSubscriptionTrigger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters