18 lines
474 B
C#
18 lines
474 B
C#
|
// MessageReceivedHandler.cs
|
||
|
|
||
|
using System;
|
||
|
using MediatR;
|
||
|
using MediatRSample.Notifications;
|
||
|
|
||
|
namespace MediatRSample;
|
||
|
|
||
|
public class MessageReceivedHandler : INotificationHandler<MessageReceivedNotification>
|
||
|
{
|
||
|
public async Task Handle(MessageReceivedNotification notification, CancellationToken cancellationToken)
|
||
|
{
|
||
|
Console.WriteLine($"MediatR works! (Received a message by {notification.Message.Author.Username})");
|
||
|
|
||
|
// Your implementation
|
||
|
}
|
||
|
}
|