using System.ComponentModel.DataAnnotations; namespace TakeoutSaaS.Module.Messaging.Options; /// /// RabbitMQ 连接与交换机配置。 /// public sealed class RabbitMqOptions { /// /// 主机名。 /// [Required] public string Host { get; set; } = "localhost"; /// /// 端口。 /// [Range(1, 65535)] public int Port { get; set; } = 5672; /// /// 用户名。 /// [Required] public string Username { get; set; } = "guest"; /// /// 密码。 /// [Required] public string Password { get; set; } = "guest"; /// /// 虚拟主机。 /// public string VirtualHost { get; set; } = "/"; /// /// 默认交换机名称。 /// [Required] public string Exchange { get; set; } = "takeout.events"; /// /// 交换机类型,默认 topic。 /// public string ExchangeType { get; set; } = "topic"; /// /// 消费预取数量。 /// [Range(1, 1000)] public ushort PrefetchCount { get; set; } = 20; }