using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JiShe.CollectBus.Kafka.Attributes { [AttributeUsage(AttributeTargets.Method)] public class KafkaSubscribeAttribute : Attribute { /// /// 订阅的主题 /// public string[] Topics { get; set; } /// /// 分区 /// public int Partition { get; set; } = -1; /// /// 消费者组 /// public string GroupId { get; set; } public KafkaSubscribeAttribute(string[] topics, string groupId = "default") { this.Topics = topics; this.GroupId = groupId; } public KafkaSubscribeAttribute(string topic, string groupId = "default") { this.Topics = new string[] { topic }; this.GroupId = groupId; } public KafkaSubscribeAttribute(string[] topics, int partition, string groupId = "default") { this.Topics = topics; this.Partition = partition; this.GroupId = groupId; } public KafkaSubscribeAttribute(string topic, int partition, string groupId = "default") { this.Topics = new string[] { topic }; this.Partition = partition; this.GroupId = groupId; } } }