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
using System.Threading.Channels; | |
var notificator = new SlackNotificator(); // should be singleton | |
await Task.Delay(10); // give some time to init reader | |
// send some notifications with priority (higher number - higher priority) | |
var items = new[] | |
{ | |
notificator.SendAsync(new Notification(1)), |
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
public abstract class ValueObject : IEquatable<ValueObject> | |
{ | |
public bool Equals(ValueObject? other) | |
{ | |
if (ReferenceEquals(this, other)) | |
{ | |
return true; | |
} | |
return other is not null && |
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
public interface IMessageDto {} // базовый интерфейс для всех DTO, здесь пустой, но может иметь уникальный ид, время создания и т.п | |
public interface IRabbitMessage {} // интерфейс для нетипизированных сообщений, здесь пустой, но по задумке владеет информацией о том откуда сообщение получить (роуты, обменники) | |
public interface IRabbitMessage<T> : IRabbitMessage // типизированный вариант IRabbitMessage | |
where T : IMessageDto | |
{ | |
} | |
// одна из конкретных реализаций, для примера | |
public class MetricsRabbitMessage : IRabbitMessage<MetricsDto> { } |