24 lines
653 B
C#
Raw Normal View History

2025-04-09 14:33:20 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JiShe.CollectBus.Kafka.Consumer
{
2025-04-12 15:11:18 +08:00
public interface IConsumerService<TKey, TValue>
2025-04-09 14:33:20 +08:00
{
2025-04-12 15:11:18 +08:00
Task SubscribeAsync(string topic, Func<TKey, TValue, Task> messageHandler);
void Unsubscribe();
void Dispose();
2025-04-15 11:15:22 +08:00
/// <summary>
/// 订阅多个topic
/// </summary>
/// <param name="topics"></param>
/// <param name="messageHandler"></param>
/// <returns></returns>
Task SubscribeAsync(string[] topics, Func<TKey, TValue, Task> messageHandler);
2025-04-09 14:33:20 +08:00
}
}