namespace TakeoutSaaS.Module.Messaging.Abstractions;

/// <summary>
/// 消息订阅抽象。
/// </summary>
public interface IMessageSubscriber : IAsyncDisposable
{
    /// <summary>
    /// 订阅指定队列与路由键，处理后返回是否消费成功。
    /// </summary>
    Task SubscribeAsync<T>(string queue, string routingKey, Func<T, CancellationToken, Task<bool>> handler, CancellationToken cancellationToken = default);
}
