Dotnet.Cap 源码
CapSubscribeAttribute 特性
public class CapSubscribeAttribute : TopicAttribute
{
public CapSubscribeAttribute(string name, bool isPartial = false)
: base(name, isPartial)
{
}
public override string ToString()
{
return Name;
}
}
Name 主题 或者 路由Key 名称
Group
RabbitMQ --> queue.name
Kafka --> groups.id
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)]
public abstract class TopicAttribute : Attribute
{
protected TopicAttribute(string name, bool isPartial = false)
{
Name = name;
IsPartial = isPartial;
}
/// <summary>
/// Topic or exchange route key name.
/// </summary>
public string Name { get; }
/// <summary>
/// Defines whether this attribute defines a topic subscription partial.
/// The defined topic will be combined with a topic subscription defined on class level,
/// which results for example in subscription on "class.method".
/// </summary>
public bool IsPartial { get; }
/// <summary>
/// Default group name is CapOptions setting.(Assembly name)
/// Kafka --> groups.id
/// RabbitMQ --> queue.name
/// </summary>
public string Group { get; set; } = default!;
/// <summary>
/// Limit the number of messages consumed concurrently.
/// If you set this value but don't specify the Group, we will automatically create a Group using the Name.
/// </summary>
public byte GroupConcurrent { get; set; }
}
浙公网安备 33010602011771号