添加项目文件。
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using ContactService.Domain.Events;
|
||||
using IM.Commons.IntegrationEvents;
|
||||
using MassTransit;
|
||||
using MediatR;
|
||||
|
||||
namespace ContactService.WebApi.Application.EventHandler
|
||||
{
|
||||
public class FriendAddedHandler : INotificationHandler<FriendAddedDomainEvent>
|
||||
{
|
||||
private readonly IPublishEndpoint endpoint;
|
||||
|
||||
public FriendAddedHandler(IPublishEndpoint endpoint)
|
||||
{
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
|
||||
public async Task Handle(FriendAddedDomainEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
await endpoint.Publish(new FriendAddedEvent
|
||||
{
|
||||
OwnerAvatar = notification.Friend.Owner.Avatar,
|
||||
OwnerId = notification.Friend.Owner.Id,
|
||||
OwnerNickName = notification.Friend.Owner.NickName,
|
||||
TargetAvatar = notification.Friend.Target.Avatar,
|
||||
TargetId = notification.Friend.Target.Id,
|
||||
TargetNickName = notification.Friend.Target.NickName,
|
||||
RemarkName = notification.Friend.RemarkName,
|
||||
Status = notification.Friend.Status.ToString(),
|
||||
}, cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user