Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GrantFanoutPublisher{TM}"/> class.
 /// 消息发布者  非默认,一个自定义的消息交换机、队列、路由key
 /// </summary>
 /// <param name="msg">消息</param>
 /// <param name="exchange">交换机</param>
 /// <param name="queueName">队列</param>
 /// <param name="autoDelete">是否自动删除</param>
 public GrantFanoutPublisher(TM msg, string exchange, string queueName, bool autoDelete)
     : base(
         mq: new MQueue()
 {
     AutoDeclare = false,
     AutoDelete  = autoDelete,
     Durable     = true,
     Exchange    = new Exchange()
     {
         AutoDeclare  = false,
         AutoDelete   = false,
         Durable      = true,
         ExchangeType = ExchangeType.Fanout,
         ExchangeName = exchange,
     },
     Exclusive = false,
     QueueName = queueName,
     Host      = MQHostConfigManager.GetDefaultHost(),
 }, msg: msg)
 {
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GrantDefaultConsumer{M}"/> class.
 /// 消费者,一个完全自定义的消费者
 /// </summary>
 /// <param name="exchange">exchange</param>
 /// <param name="routeKey">routeKey</param>
 /// <param name="queueName">queueName</param>
 /// <param name="autoDelete">autoDelete</param>
 public GrantDefaultConsumer(string exchange, string routeKey, string queueName, bool autoDelete)
     : base(new MQueue()
 {
     AutoDeclare = false,
     AutoDelete  = autoDelete,
     Durable     = true,
     Exchange    = new Exchange()
     {
         AutoDeclare  = false,
         AutoDelete   = false,
         Durable      = true,
         ExchangeType = ExchangeType.Direct,
         ExchangeName = exchange,
     },
     Exclusive = false,
     QueueName = queueName,
     RouteKey  = routeKey,
     Host      = MQHostConfigManager.GetDefaultHost(),
 })
 {
 }