-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #992 from colinin/new-user-session
feat(session): 新用户默认订阅会话过期事件
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...RealtimeMessage.HttpApi.Host/EventBus/Local/UserSubscribeSessionExpirationEventHandler.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,28 @@ | ||
using LINGYUN.Abp.Identity.Notifications; | ||
using LINGYUN.Abp.Notifications; | ||
using System.Threading.Tasks; | ||
using Volo.Abp.DependencyInjection; | ||
using Volo.Abp.Domain.Entities.Events; | ||
using Volo.Abp.EventBus; | ||
using Volo.Abp.Users; | ||
|
||
namespace LY.MicroService.RealtimeMessage.EventBus; | ||
|
||
public class UserSubscribeSessionExpirationEventHandler : ILocalEventHandler<EntityCreatedEventData<UserEto>>, ITransientDependency | ||
{ | ||
private readonly INotificationSubscriptionManager _notificationSubscriptionManager; | ||
|
||
public UserSubscribeSessionExpirationEventHandler(INotificationSubscriptionManager notificationSubscriptionManager) | ||
{ | ||
_notificationSubscriptionManager = notificationSubscriptionManager; | ||
} | ||
|
||
public async virtual Task HandleEventAsync(EntityCreatedEventData<UserEto> eventData) | ||
{ | ||
await _notificationSubscriptionManager | ||
.SubscribeAsync( | ||
eventData.Entity.TenantId, | ||
new UserIdentifier(eventData.Entity.Id, eventData.Entity.UserName), | ||
IdentityNotificationNames.Session.ExpirationSession); | ||
} | ||
} |