using Confluent.Kafka; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JiShe.CollectBus.Kafka.Consumer { public interface IConsumerService { Task SubscribeAsync(string topic, Func> messageHandler, string? groupId=null) where TKey : notnull where TValue : class; /// /// 订阅消息 /// /// /// /// /// Task SubscribeAsync(string topic, Func> messageHandler, string? groupId = null) where TValue : class; Task SubscribeAsync(string[] topics, Func> messageHandler, string? groupId) where TKey : notnull where TValue : class; /// /// 订阅消息 /// /// /// /// /// /// Task SubscribeAsync(string[] topics, Func> messageHandler, string? groupId = null) where TValue : class; Task SubscribeBatchAsync(string topic, Func, Task> messageBatchHandler, string? groupId = null, int batchSize = 100, TimeSpan? batchTimeout = null) where TKey : notnull where TValue : class; Task SubscribeBatchAsync(string[] topics, Func, Task> messageBatchHandler, string? groupId = null, int batchSize = 100, TimeSpan? batchTimeout = null, TimeSpan? consumeTimeout = null) where TValue : class; void Unsubscribe() where TKey : notnull where TValue : class; } }