You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.5 KiB
C#

namespace Admin.Core.EventBus
{
/// <summary>
/// 事件总线
/// 接口
/// </summary>
public interface IEventBus
{
/// <summary>
/// 发布
/// </summary>
/// <param name="event">事件模型</param>
void Publish(IntegrationEvent @event);
/// <summary>
/// 订阅
/// </summary>
/// <typeparam name="T">约束:事件模型</typeparam>
/// <typeparam name="TH">约束:事件处理器<事件模型></typeparam>
void Subscribe<T, TH>()
where T : IntegrationEvent
where TH : IIntegrationEventHandler<T>;
/// <summary>
/// 取消订阅
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="TH"></typeparam>
void Unsubscribe<T, TH>()
where TH : IIntegrationEventHandler<T>
where T : IntegrationEvent;
/// <summary>
/// 动态订阅
/// </summary>
/// <typeparam name="TH">约束:事件处理器</typeparam>
/// <param name="eventName"></param>
void SubscribeDynamic<TH>(string eventName)
where TH : IDynamicIntegrationEventHandler;
/// <summary>
/// 动态取消订阅
/// </summary>
/// <typeparam name="TH"></typeparam>
/// <param name="eventName"></param>
void UnsubscribeDynamic<TH>(string eventName)
where TH : IDynamicIntegrationEventHandler;
}
}