Files
lux/EgwCoreLib.Lux.Data/Services/Internal/IRedisSubscriptionManager.cs
T
2026-03-25 08:24:25 +01:00

41 lines
1.5 KiB
C#

namespace EgwCoreLib.Lux.Data.Services.Internal
{
/// <summary>
/// Interfaccia gestore sottoscrizioni Redis
/// </summary>
public interface IRedisSubscriptionManager : IDisposable
{
#region Public Methods
/// <summary>
/// Sottoscrizioni a un canale
/// </summary>
/// <param name="channel">Nome del canale</param>
/// <param name="handler">Handler per i messaggi</param>
/// <returns>True se sottoscrizione andata a buon fine</returns>
bool Subscribe(string channel, Action<RedisChannel, RedisValue> handler);
/// <summary>
/// Prova a sottoscriversi (cattura eccezioni e ritorna false)
/// </summary>
/// <param name="channel">Nome del canale</param>
/// <param name="handler">Handler per i messaggi</param>
/// <returns>True se sottoscrizione andata a buon fine</returns>
bool TrySubscribe(string channel, Action<RedisChannel, RedisValue> handler);
/// <summary>
/// Si disiscrive da un canale
/// </summary>
/// <param name="channel">Nome del canale</param>
/// <returns>True se disiscrizione andata a buon fine</returns>
bool Unsubscribe(string channel);
/// <summary>
/// Restituisce l'elenco dei canali attivi
/// </summary>
/// <returns>Elenco dei canali sottoscritti</returns>
IEnumerable<string> GetActiveChannels();
#endregion Public Methods
}
}