Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

24 lines (21 sloc) 780 Bytes
using System.Threading;
using System.Threading.Tasks;
using ChatService.Hubs;
using MediatR;
using Microsoft.AspNetCore.SignalR;
using PolicyService.Api.Events;
namespace ChatService.Listeners
{
public class PolicyCreatedHandler : INotificationHandler<PolicyCreated>
{
private readonly IHubContext<AgentChatHub> chatHubContext;
public PolicyCreatedHandler(IHubContext<AgentChatHub> chatHubContext)
{
this.chatHubContext = chatHubContext;
}
public async Task Handle(PolicyCreated notification, CancellationToken cancellationToken)
{
await chatHubContext.Clients.All.SendAsync("ReceiveNotification", $"{notification.AgentLogin} just sold policy for {notification.ProductCode}!!!");
}
}
}
You can’t perform that action at this time.