using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events; using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.EventBus.Distributed; using Volo.Abp.EventBus.Local; using Volo.Abp.Users; namespace LY.MicroService.Applications.Single.EventBus.Distributed { public class UserCreateEventHandler : IDistributedEventHandler>, ITransientDependency { private readonly ILocalEventBus _localEventBus; public UserCreateEventHandler( ILocalEventBus localEventBus) { _localEventBus = localEventBus; } /// /// 接收添加用户事件,发布本地事件 /// /// /// public async Task HandleEventAsync(EntityCreatedEto eventData) { var localUserCreateEventData = new EntityCreatedEventData(eventData.Entity); await _localEventBus.PublishAsync(localUserCreateEventData); } } }