zeroframework/BuildingBlocks/EventBus/ZeroFramework.EventBus/IEventBusSubscriptionsManager.cs

35 lines
1.1 KiB
C#
Raw Permalink Normal View History

2023-12-05 09:22:48 +00:00
using ZeroFramework.EventBus.Abstractions;
using ZeroFramework.EventBus.Events;
using static ZeroFramework.EventBus.InMemoryEventBusSubscriptionsManager;
namespace ZeroFramework.EventBus
{
public interface IEventBusSubscriptionsManager
{
bool IsEmpty { get; }
event EventHandler<string> OnEventRemoved;
void AddDynamicSubscription<TH>(string eventName) where TH : IDynamicIntegrationEventHandler;
void RemoveDynamicSubscription<TH>(string eventName) where TH : IDynamicIntegrationEventHandler;
void AddSubscription<T, TH>() where T : IntegrationEvent where TH : IIntegrationEventHandler<T>;
void RemoveSubscription<T, TH>() where TH : IIntegrationEventHandler<T> where T : IntegrationEvent;
bool HasSubscriptionsForEvent<T>() where T : IntegrationEvent;
bool HasSubscriptionsForEvent(string eventName);
Type GetEventTypeByName(string eventName);
void Clear();
IEnumerable<SubscriptionInfo> GetHandlersForEvent<T>() where T : IntegrationEvent;
IEnumerable<SubscriptionInfo> GetHandlersForEvent(string eventName);
string GetEventKey<T>();
}
}