using Dpz.Core.MessageQueue.Enums;
namespace Dpz.Core.MessageQueue.Attributes;
/// <summary>
/// 消息路由配置特性
/// 使用约定优于配置的方式,只在需要自定义时使用
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class MessageRouteAttribute : Attribute
{
/// <summary>
/// Exchange名称(可选,默认根据消息类型自动生成)
/// </summary>
public string? ExchangeName { get; set; }
/// <summary>
/// Exchange类型(默认Topic)
/// </summary>
public ExchangeType ExchangeType { get; set; } = ExchangeType.Topic;
/// <summary>
/// 路由键(可选,默认根据消息类型自动生成)
/// </summary>
public string? RoutingKey { get; set; }
/// <summary>
/// 队列名称(可选,默认根据消息类型自动生成)
/// </summary>
public string? QueueName { get; set; }
/// <summary>
/// 是否持久化
/// </summary>
public bool Durable { get; set; } = true;
/// <summary>
/// 是否自动删除(无消费者时)
/// </summary>
public bool AutoDelete { get; set; } = false;
}
评论加载中...